Skip to content

fix(test): constant def count in the wide-flat scaling fixture#936

Merged
DeusData merged 1 commit into
mainfrom
fix/wide-flat-const-defs
Jul 7, 2026
Merged

fix(test): constant def count in the wide-flat scaling fixture#936
DeusData merged 1 commit into
mainfrom
fix/wide-flat-const-defs

Conversation

@DeusData

@DeusData DeusData commented Jul 7, 2026

Copy link
Copy Markdown
Owner

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.

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>
@DeusData DeusData merged commit 5554f8a into main Jul 7, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant