8000 dict: Use DK_LOG_SIZE in hot loop. by methane · Pull Request #31405 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

dict: Use DK_LOG_SIZE in hot loop. #31405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2022
Merged

dict: Use DK_LOG_SIZE in hot loop. #31405

merged 2 commits into from
Feb 19, 2022

Conversation

methane
Copy link
Member
@methane methane commented Feb 18, 2022

DK_LOG_SIZE(key) < 8 is faster than DK_SIZE(key) <= 0xff, at least on
GCC.

DK_LOG_SIZE(key) < 8 is faster than DK_SIZE(key) <= 0xff, at least on
GCC.
@methane
Copy link
Member Author
methane commented Feb 18, 2022
  • Ubuntu 20.04 LTS
  • gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
  • without --enable-optimization --with-lto
$ cpython/python -m pyperf compare_to main.json main2.json -G --min-speed=1
Slower (3):
- scimark_sparse_mat_mult: 6.70 ms +- 0.10 ms -> 6.95 ms +- 0.10 ms: 1.04x slower
- nqueens: 114 ms +- 1 ms -> 117 ms +- 1 ms: 1.03x slower
- float: 95.9 ms +- 1.6 ms -> 97.4 ms +- 1.3 ms: 1.02x slower

Faster (25):
- pickle_dict: 39.2 us +- 4.6 us -> 36.3 us +- 0.2 us: 1.08x faster
- regex_effbot: 3.98 ms +- 0.04 ms -> 3.72 ms +- 0.02 ms: 1.07x faster
- regex_v8: 29.9 ms +- 0.4 ms -> 28.4 ms +- 0.3 ms: 1.05x faster
- deltablue: 5.79 ms +- 0.42 ms -> 5.58 ms +- 0.08 ms: 1.04x faster
- sympy_expand: 694 ms +- 11 ms -> 675 ms +- 4 ms: 1.03x faster
- mako: 13.7 ms +- 0.1 ms -> 13.3 ms +- 0.1 ms: 1.03x faster
- sympy_str: 416 ms +- 7 ms -> 405 ms +- 3 ms: 1.03x faster
- scimark_fft: 475 ms +- 24 ms -> 464 ms +- 7 ms: 1.02x faster
- json_dumps: 16.6 ms +- 0.3 ms -> 16.2 ms +- 0.1 ms: 1.02x faster
- scimark_lu: 153 ms +- 7 ms -> 149 ms +- 2 ms: 1.02x faster
- unpack_sequence: 56.1 ns +- 1.4 ns -> 54.9 ns +- 0.9 ns: 1.02x faster
- regex_dna: 238 ms +- 2 ms -> 233 ms +- 1 ms: 1.02x faster
- unpickle_list: 6.06 us +- 0.21 us -> 5.94 us +- 0.08 us: 1.02x faster
- regex_compile: 185 ms +- 3 ms -> 182 ms +- 1 ms: 1.02x faster
- spectral_norm: 147 ms +- 3 ms -> 145 ms +- 1 ms: 1.02x faster
- sympy_integrate: 27.6 ms +- 0.4 ms -> 27.2 ms +- 0.3 ms: 1.02x faster
- pickle_list: 5.45 us +- 0.07 us -> 5.36 us +- 0.05 us: 1.02x faster
- django_template: 51.0 ms +- 1.2 ms -> 50.3 ms +- 0.5 ms: 1.02x faster
- dulwich_log: 100 ms +- 5 ms -> 99.1 ms +- 0.7 ms: 1.01x faster
- crypto_pyaes: 111 ms +- 2 ms -> 110 ms +- 1 ms: 1.01x faster
- chameleon: 9.18 ms +- 0.08 ms -> 9.07 ms +- 0.10 ms: 1.01x faster
- hexiom: 8.40 ms +- 0.08 ms -> 8.30 ms +- 0.14 ms: 1.01x faster
- xml_etree_parse: 183 ms +- 4 ms -> 181 ms +- 1 ms: 1.01x faster
- tornado_http: 153 ms +- 4 ms -> 152 ms +- 2 ms: 1.01x faster
- unpickle_pure_python: 349 us +- 8 us -> 345 us +- 2 us: 1.01x faster

Benchmark hidden because not significant (31): 2to3, chaos, fannkuch, go, html5lib, json_loads, logging_format, logging_silent, logging_simple, meteor_contest, nbody, pathlib, pickle, pickle_pure_python, pidigits, pyflate, python_startup, python_startup_no_site, raytrace, richards, scimark_monte_carlo, scimark_sor
, sqlalchemy_declarative, sqlalchemy_imperative, sqlite_synth, sympy_sum, telco, unpickle, xml_etree_iterparse, xml_etree_generate, xml_etree_process

Geometric mean: 1.01x faster

@markshannon
Copy link
Member

Apart from one variable name, looks good.

@methane methane merged commit 5543d9c into python:main Feb 19, 2022
@methane methane deleted the dict-dksize branch February 19, 2022 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0