fix(test): constant def count in the wide-flat scaling fixture#936
Merged
Conversation
The guard's sparse defs scaled WITH the input (one per 2000 lines), so the fixture inherited a slice of the separate per-def sibling-scan cost (O(defs x siblings) — its own tracked finding): an n^2/2000 term that is negligible on clang-macOS but dominant enough on windows-CLANG64 ASan to push LINEAR walk code to a 43x measured ratio, over the 40x bound. Ten defs at fixed positions regardless of size keep the anti-vacuous breadth check while the sibling-scan term stays 10 x n = linear. Measured after the change: fixed code 22x, pre-merge quadratic walk 339x — the discriminator now has ~2x headroom on the green side and ~8x on the red side across all three toolchains measured. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
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.
The scaling guard's sparse defs grew with input size, dragging the separate per-def sibling-scan cost (O(defs×siblings), tracked as its own finding) into the measurement — negligible on clang-macOS (ratio 19-22) but dominant on windows-CLANG64 ASan, where LINEAR walk code measured 43x against the 40x bound. Ten fixed-position defs keep the breadth check honest while that term stays linear.
Measured after the change: fixed code 22x, pre-merge quadratic walk 339x (RED-verified). ~2x green-side and ~8x red-side headroom across the three measured toolchains.