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
Reduce temporary unicode object while adding descriptors #73569
Comments
add_methods(), add_members(), and add_getset() creates PyUnicode from C string 3 times, and calls PyUnicode_InternInplace 2 times.
Skipping (2) is require adding new private APIs to pass PyUnicodeObject. It seems ~1% startup speedup (without site). $ ./python -m performance.benchmarks.bm_python_startup --no-site
default: python_startup_no_site: Median +- std dev: 12.7 ms +- 0.1 ms
patched: python_startup_no_site: Median +- std dev: 12.6 ms +- 0.1 ms While speedup is small, this patch removes time to think "How large this Additionally, this patch removes this comment in PyDict_SetItemString:
SetItemString is used to add something to namespace. |
I think I found better way. Interned string can be get from descripter. Interning can be reduced |
descr-remove-getitemstring-2.patch is more compact than first patch. python_startup_no_site: Median +- std dev: 12.5 ms +- 0.1 ms |
descr-remove-getitemstring-2.patch LGTM. |
New changeset d7ec72c1620c by INADA Naoki in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: