Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-103977: compile re expressions in platform.py only if required#103981
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
JelleZijlstra commentedApr 29, 2023
Can you run |
TeamSpen210 commentedApr 29, 2023
Since they’re now all local variables, it might be nice to remove the underscore prefixes. |
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2023-04-28-19-08-50.gh-issue-103977.msF70A.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…sF70A.rstCo-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
bedevere-bot commentedApr 30, 2023
|
JelleZijlstra commentedApr 30, 2023
Seems unlikely that this would cause a segfault in test_threading. |
hugovk commentedApr 30, 2023
And backport to 3.11? |
JelleZijlstra commentedApr 30, 2023
I don't think so; we don't backport perf improvements. |
* main: (26 commits)pythongh-104028: Reduce object creation while calling callback function from gc (pythongh-104030)pythongh-104036: Fix direct invocation of test_typing (python#104037)pythongh-102213: Optimize the performance of `__getattr__` (pythonGH-103761)pythongh-103895: Improve how invalid `Exception.__notes__` are displayed (python#103897) Adjust expression from `==` to `!=` in alignment with the meaning of the paragraph. (pythonGH-104021)pythongh-88496: Fix IDLE test hang on macOS (python#104025) Improve int test coverage (python#104024)pythongh-88773: Added teleport method to Turtle library (python#103974)pythongh-104015: Fix direct invocation of `test_dataclasses` (python#104017)pythongh-104012: Ensure test_calendar.CalendarTestCase.test_deprecation_warning consistently passes (python#104014)pythongh-103977: compile re expressions in platform.py only if required (python#103981)pythongh-98003: Inline call frames for CALL_FUNCTION_EX (pythonGH-98004) Replace Netlify with Read the Docs build previews (python#103843) Update name in acknowledgements and add mailmap (python#103696)pythongh-82054: allow test runner to split test_asyncio to execute in parallel by sharding. (python#103927) Remove non-existing tools from Sundry skiplist (python#103991)pythongh-103793: Defer formatting task name (python#103767)pythongh-87092: change assembler to use instruction sequence instead of CFG (python#103933)pythongh-103636: issue warning for deprecated calendar constants (python#103833) Various small fixes to dis docs (python#103923) ...
Uh oh!
There was an error while loading.Please reload this page.
In
platform.pythere are several regular expressions compiled during import that might not be used at all. The regular expressions are only called once at most, since they are called from within cached methods. We can eliminate the cost of compilation by moving the regular expressions into the methods.The import time of
platform.py(measured withhttps://github.com/sympy/sympy/blob/master/bin/test_import, adapted for platform.py):Notes:
_libc_searchandcomponent_rewhich are used in the methodlibc_ver(not cached). Thelibc_veris called fromplatformwhich is cached.If we expect
libc_verto be called many times, it should be cached as well, or the_libc_searchregular expression moved back as a module variable.collections)@hauntsaninja This is a followup of#102492