GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — gh-129813: Use `PyBytesWriter` in `_json:_match_number_unicode` by maurycy · Pull Request #138957 · python/cpython Conversation
|
| Benchmark | json-main | json-pybytes |
|---|---|---|
| json_loads_1000_ints | 41.4 us | 47.3 us: 1.14x slower |
| json_loads_1000_floats | 77.1 us | 81.9 us: 1.06x slower |
| Geometric mean | (ref) | 1.10x slower |
which makes perfect sense given the conversion:
I mixed up the JSONs; my bad.
I'm surprised with the speed up:
import pyperf import json runner = pyperf.Runner() num_elements = 1000 int_data = json.dumps(list(range(num_elements))) runner.bench_func(f'json_loads_{num_elements}_ints', json.loads, int_data) float_data = json.dumps([float(i) for i in range(num_elements)]) runner.bench_func(f'json_loads_{num_elements}_floats', json.loads, float_data)
Where main is 4e00e25
The environment:
% ./python -c "import sysconfig; print(sysconfig.get_config_var('CONFIG_ARGS'))"
'--enable-lto' '--with-optimizations'
sudo ./python -m pyperf system tune ensured.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PyBytesWriter in _json:_match_number_unicode; json.loads with int or float 1.14x fasterPyBytesWriter in _json:_match_number_unicode; json.loads with int or float ~1.1x faster
PyBytesWriter in _json:_match_number_unicode; json.loads with int or float ~1.1x fasterPyBytesWriter in _json:_match_number_unicode
|
I'm closing it. I don't think it's making things better. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.