Repository navigation
perf(parser): keep the error oracle linear on many rebuilt entries - #3069
Merged
Merged
Conversation
with_rebuilt_builder_errors looked each rebuilt entry up by scanning every statement of the trace, and each of its builder errors up by scanning every error; the stray-carriage-return and divide-by-zero overlays scanned every slot for each error they claimed. On 64,000 rebuilt entries with stray `\r`s a parse took 3.1 s (8,000: 0.16 s), and test_parse_nested_entries_and_their_tails_parse_in_linear_time timed out under coverage instrumentation in CI. Built statements are now a set, errors are searched by start, and the overlays sort the slots' lines once. The two shapes join the oracle's linear-time test. No output changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
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.
What
The error oracle is now linear in three places where it was quadratic. I found them because
test_parse_nested_entries_and_their_tails_parse_in_linear_timetimed out under coverage instrumentation on #3066 (10.1 s for 16,000 lines against 0.30 s for 2,000). The cost was already on main, since #3062.with_rebuilt_builder_errors: for each rebuilt entry it scanned every statement of the trace, and for each builder error it scanned every error. Built statements are now aHashSet, and errors are binary-searched by start, with the ones it adds kept in a map.stray-carriage-returnanddivide-by-zerooverlays: they scanned every slot for each error they claimed. They now sort the slots' lines once.Measurements (release)
Input:
$followed by N copies of2024-01-02 open\rAssets:Z\n 2024-01-02 open Assets:Z\n. Each copy is two rebuilt entries.32,000
custom "x" 1/0 $lines take 0.11 s.Tests and gates
STRICT_BASELINEand the parser suite pass.This PR is independent of the others. Merging it first takes the timing flake off the other PRs' coverage runs.
🤖 Generated with Claude Code