Skip to content

Commit 5554f8a

Browse files
authored
Merge pull request DeusData#936 from DeusData/fix/wide-flat-const-defs
fix(test): constant def count in the wide-flat scaling fixture
2 parents 4630d2a + 975dc76 commit 5554f8a

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎tests/test_extraction.c‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,9 +3418,15 @@ static long extract_wide_flat_ms(int n, int *out_defs) {
34183418
return -1;
34193419
}
34203420
size_t off = 0;
3421+
/* CONSTANT def count (10), independent of n: defs that scale WITH n make
3422+
* the fixture superlinear through the separate per-def sibling-scan cost
3423+
* (O(defs x siblings)) — on windows-CLANG64 ASan that pushed the ratio
3424+
* of LINEAR walk code to 43x. Ten spread-out defs keep the breadth check
3425+
* honest while the sibling-scan term stays 10 x n = linear. */
3426+
const int def_stride = n / 10;
34213427
for (int i = 0; i < n; i++) {
34223428
off += (size_t)snprintf(src + off, cap - off, "// wide filler %d\n", i);
3423-
if (i % 2000 == 0) {
3429+
if (i % def_stride == 0) {
34243430
off += (size_t)snprintf(src + off, cap - off, "var wide_a%d = %d;\n", i, i);
34253431
}
34263432
}
@@ -3467,8 +3473,8 @@ TEST(extract_wide_flat_file_is_linear) {
34673473
ASSERT_GTE(t_small, 0);
34683474
ASSERT_GTE(t_big, 0);
34693475
/* Anti-vacuous guard: the breadth was actually walked at both sizes. */
3470-
ASSERT_GTE(defs_small, 10);
3471-
ASSERT_GTE(defs_big, 40);
3476+
ASSERT_GTE(defs_small, 8);
3477+
ASSERT_GTE(defs_big, 8);
34723478
fprintf(stderr, " [wide-flat] t(%d)=%ldms t(%d)=%ldms\n", WF_SMALL, t_small, WF_BIG, t_big);
34733479
long base = t_small > WF_FLOOR_MS ? t_small : WF_FLOOR_MS;
34743480
if (t_big > WF_RATIO_MAX * base) {

0 commit comments

Comments
 (0)