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-161125: Avoid redundant work in regex compilation by SHURIKA6 · Pull Request #161600 · python/cpython Conversation
|
| build | run 1 (mean ± sd) | run 2 (mean ± sd) |
|---|---|---|
main a497a11c46 |
263.8 ± 25.1 ms | 287.4 ± 44.7 ms |
| main + this PR | 228.3 ± 33.9 ms | 241.4 ± 22.1 ms |
| 3.15.2 (reference) | 235.8 ± 18.0 ms | 293.7 ± 53.4 ms |
Paired by run, this branch is 1.16x-1.19x faster than main and back in
the range of 3.15.2. The machine is noisy (the 3.15.2 runs differ by 25%
between themselves), so I would not read anything into the remaining
few percent.
python -m test test_re: 173 tests, 4 skipped, all pass.test_optimizer_walk_only_for_fusable_patterns pins theState() keeps the "must optimize" default.Developed with AI assistance for the analysis, the patch draft and the
benchmark scripts. I reviewed every line, ran the tests and benchmarks
myself, and can explain the change in my own words.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
pythongh-152214 added a set-operation fusion pass to the pattern compiler. optimize() walks the whole parsed tree unconditionally, so patterns that contain no fusable construct pay for a full extra pass and get nothing in return. On main this makes re.compile() about 15-20% slower than 3.15. Have the parser record whether the tree holds a construct that the fusion pass can rewrite, and walk only in that case. The marker stays None for trees that were not produced by parse() (such as the ones re.Scanner assembles by hand), so those are still optimized as before.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thank you for your interest in contributing to Python. This is a community-driven project, and we want it to be a welcoming place to learn and collaborate. Contributors are responsible for reviewing and understanding what they submit, checking its claims, and being able to explain changes in their own words. This helps reviewers focus on the contribution and leaves more time to support other contributors. We believe this contribution does not meet our guidelines for using AI tools, so we're closing it. If you think we've misunderstood your contribution, please let us know. You're welcome to explain your approach or ask questions about the guidelines. Please read our guidelines for using AI tools. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A core dev is more likely to address this. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
But do you think you're right? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The issue hasn't been open for enough time and no consensus on how to fix this has been made, so yes, a core dev must first acknowledge the direction of the fix. |
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.