Repository navigation
Reuse flat scope plans when assertions preserve local order - #1321
Merged
Merged
Conversation
Merging this PR will improve performance by 13.21%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | large_dataset |
14 ms | 12.3 ms | +13.24% |
| ⚡ | large_dataset |
14 ms | 12.4 ms | +13.19% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing charlie/codex-flat-scope-order-main-20261017 (72ea685) with main (2ecbc63)
Footnotes
-
7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
charliermarsh
marked this pull request as ready for review
October 17, 2026 21:50
charliermarsh
deleted the
charlie/codex-flat-scope-order-main-20261017
branch
October 17, 2026 21:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We reuse flat function inputs during optimized compilation when removing assertions cannot change local ordering. We record whether each name first occurs inside an assertion without growing the stored name entries, retaining the existing collector when bound-name order or private aliases need it.
Matched Python 3.15 O2 profiles use about 0.26% fewer instructions for Mypy and 3.57% fewer for SymPy. Mypy improves by 0.28% at Python 3.13 O1; the O0 controls increase by about 0.04%. All measured outputs are byte-identical.
The 177-case instruction geometric mean improves by 0.09%, with individual changes from -13.23% to +2.78%. The largest regression is the O2 annotation microbenchmark. Native peak RSS falls about 1.45% for Mypy and increases about 0.3 MiB for SymPy; timing is noisy, so we make no native speed claim.
CodSpeed reports about 13% higher efficiency on the O1 and O2 large-dataset benchmarks, with the other 175 measured cases unchanged. It flags significant system time in the O1 async microbenchmark.
Full compatibility validation passes for Python 3.12 through 3.15 at all optimization levels, with unchanged results.