mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-12-04 00:17:24 +00:00
* test(bench): gate Dart deferred-import resolution and its scaling `import 'm.dart' deferred as p;` resolves through the same namespace path as `as p` since #3882, except that `p.loadLibrary` is dropped at capture time. bench/dart-deferred-imports pins what that path resolves and checks that its cost grows linearly, following bench/ruby-gem-resolution: exact accuracy cells and fingerprints, with ratios as the only timing gates. The workload has N libraries that all declare the same names and one file that imports each through a deferred prefix and calls through it M times. The same workload spelled `as p` is the control and must hash equal. Shapes are 16x16, 64x16 and 16x64. Capture (emitDartScopeCaptures) and resolution (runScopeResolution over parse-worker output, replayed through mergeChunkResults) are timed separately: min of 15 after 2 warmups, all six workloads interleaved in one process. Peak RSS per shape comes from a fresh process. Gated: capture scaling along both axes and resolution scaling along uses (1.5); resolution scaling along prefixes (2.2, because a per-Function-scope namespace snapshot that predates #3882 makes it O(functions x prefixed imports) for `as p` too); deferred over `as p` at 64x16 (capture 2, resolution 1.5). On the commit before #3882 the runner fails because every expected edge is missing. Runs in the benchmarks (GITNEXUS_BENCH) job after the Ruby gem step. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * test(bench): run dart-deferred-imports --check as a 20 s CI profile The benchmarks job has a 30-minute timeout, and its first run with this gate took 3m10s for the full protocol, which pushed the job over the limit (cancelled at 30 minutes, after the gate itself had passed). --check now runs a CI profile: one process prepares all six workloads and runs every accuracy gate unchanged (expected edges, wrong-prefix edges, loadLibrary edges, graph equality with the `as p` control, exact counts and fingerprints), but times only the three deferred shapes plus the `as p` control at `large`, min of 5 after 1 warmup, interleaved. The shapes are halved (8/32 prefixes x 16 uses, 8 x 64). It takes 18-20 s locally. `--full` keeps the previous protocol: every workload timed, min of 15 after 2 warmups, and peak RSS from a fresh process per shape. baseline.json is re-measured for the new shapes, with separate CI and full measurements. The O(captures^2) negative control still fails three gates in the CI profile (2.054 > 2, 1.573 > 1.5, 1.63 > 1.5). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * test(bench): add Dart scaling sweep evidence * chore(bench): remove retained Dart results --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com> Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
193 lines
12 KiB
JSON
193 lines
12 KiB
JSON
{
|
||
"_what": "Synthetic Dart deferred-import gate for #3882, following bench/ruby-gem-resolution: exact accuracy cells and fingerprints, with ratios as the only timing gates. Real capture emitter, real parse worker (dist/), real Dart ScopeResolver and pubspec loader; analyze, persistence and full-pipeline memory are outside this benchmark.",
|
||
"_triage": "Shape and fingerprint failures are deterministic: inspect the corpus and the resolved edges, never rebaseline just to make CI green. The runner also fails, before any baseline comparison, when a use misses one of its expected edges, when an edge leaves its own prefix, when anything reaches a `loadLibrary`, or when the deferred graph differs from the `as p` control. For a timing failure, rerun on an idle machine and verify the report shows its profile (ci: 5 interleaved samples after 1 warmup; full: 15 after 2) before investigating a regression. Millisecond observations are context, not gates.",
|
||
"shapes": {
|
||
"deferred_small": {
|
||
"prefixes": 8,
|
||
"uses_per_prefix": 16,
|
||
"files": 9,
|
||
"capture_groups": 1697,
|
||
"relationships": 960,
|
||
"imports": 8,
|
||
"calls": 640,
|
||
"accesses": 128,
|
||
"declines": {
|
||
"receiver-unresolved": 128
|
||
},
|
||
"expected_missing": 0,
|
||
"wrong_prefix_edges": 0,
|
||
"load_library_edges": 0,
|
||
"fingerprint": "496915671753347ba083caac3477329fa320a47d5c24abfcdefbcba318f20a73"
|
||
},
|
||
"deferred_large": {
|
||
"prefixes": 32,
|
||
"uses_per_prefix": 16,
|
||
"files": 33,
|
||
"capture_groups": 6785,
|
||
"relationships": 3840,
|
||
"imports": 32,
|
||
"calls": 2560,
|
||
"accesses": 512,
|
||
"declines": {
|
||
"receiver-unresolved": 512
|
||
},
|
||
"expected_missing": 0,
|
||
"wrong_prefix_edges": 0,
|
||
"load_library_edges": 0,
|
||
"fingerprint": "99d4ec3b518b11c9d30f0fdf3d32470222683905eb8ec5b59e058b996a0d8e4f"
|
||
},
|
||
"deferred_dense": {
|
||
"prefixes": 8,
|
||
"uses_per_prefix": 64,
|
||
"files": 9,
|
||
"capture_groups": 6305,
|
||
"relationships": 3648,
|
||
"imports": 8,
|
||
"calls": 2560,
|
||
"accesses": 512,
|
||
"declines": {
|
||
"receiver-unresolved": 512
|
||
},
|
||
"expected_missing": 0,
|
||
"wrong_prefix_edges": 0,
|
||
"load_library_edges": 0,
|
||
"fingerprint": "065b50c1385a08eba25e9d177d874695c050ed35ac525125cb43ff32ae0f3e0f"
|
||
},
|
||
"prefixed_small": {
|
||
"prefixes": 8,
|
||
"uses_per_prefix": 16,
|
||
"files": 9,
|
||
"capture_groups": 1697,
|
||
"relationships": 960,
|
||
"imports": 8,
|
||
"calls": 640,
|
||
"accesses": 128,
|
||
"declines": {
|
||
"receiver-unresolved": 128
|
||
},
|
||
"expected_missing": 0,
|
||
"wrong_prefix_edges": 0,
|
||
"load_library_edges": 0,
|
||
"fingerprint": "496915671753347ba083caac3477329fa320a47d5c24abfcdefbcba318f20a73"
|
||
},
|
||
"prefixed_large": {
|
||
"prefixes": 32,
|
||
"uses_per_prefix": 16,
|
||
"files": 33,
|
||
"capture_groups": 6785,
|
||
"relationships": 3840,
|
||
"imports": 32,
|
||
"calls": 2560,
|
||
"accesses": 512,
|
||
"declines": {
|
||
"receiver-unresolved": 512
|
||
},
|
||
"expected_missing": 0,
|
||
"wrong_prefix_edges": 0,
|
||
"load_library_edges": 0,
|
||
"fingerprint": "99d4ec3b518b11c9d30f0fdf3d32470222683905eb8ec5b59e058b996a0d8e4f"
|
||
},
|
||
"prefixed_dense": {
|
||
"prefixes": 8,
|
||
"uses_per_prefix": 64,
|
||
"files": 9,
|
||
"capture_groups": 6305,
|
||
"relationships": 3648,
|
||
"imports": 8,
|
||
"calls": 2560,
|
||
"accesses": 512,
|
||
"declines": {
|
||
"receiver-unresolved": 512
|
||
},
|
||
"expected_missing": 0,
|
||
"wrong_prefix_edges": 0,
|
||
"load_library_edges": 0,
|
||
"fingerprint": "065b50c1385a08eba25e9d177d874695c050ed35ac525125cb43ff32ae0f3e0f"
|
||
}
|
||
},
|
||
"_shape_note": "Exact counts are the workload FLOOR: a shrunken corpus or a resolver that stops binding through the prefix cannot pass by doing less work. small = 8 prefixes x 16 uses, large = 32 x 16 (prefixes and libraries 4x), dense = 8 x 64 (uses per prefix 4x). Each use resolves make, helper, Svc.sm, Svc.run and the Svc constructor (CALLS) plus Svc (ACCESSES) in its own library. One decline per use is expected and identical for both forms: `p<i>.Svc().run()`, a member call on a constructor result reached through a prefix, is recorded as receiver-unresolved for `as p` on main too.",
|
||
"_fingerprint_note": "Hashes pin every relationship (endpoints, type, confidence, reason) and every decline (reason, file, name, position). Each deferred shape must hash equal to its prefixed control: the deferred form resolves exactly what `as p` resolves, and its `p<i>.loadLibrary()` calls (on the same line as the next statement, so positions match) add nothing, although every library declares a top-level `loadLibrary` the import hides.",
|
||
"budgets": {
|
||
"deferred_capture_prefix_scaling_ratio": 1.5,
|
||
"deferred_capture_use_scaling_ratio": 1.5,
|
||
"deferred_resolve_prefix_scaling_ratio": 2.2,
|
||
"deferred_resolve_use_scaling_ratio": 1.5,
|
||
"deferred_to_prefixed_capture_ratio": 2,
|
||
"deferred_to_prefixed_resolve_ratio": 1.5
|
||
},
|
||
"_scaling_note": "Scaling ratios are (t_4n/t_n)/4: about 1 is linear, about 4 is quadratic. Capture uses the 1.5 budget of bench/scope-capture (the same emitter family); resolution along the use axis uses it too. The prefixed_* ratios are reported as the control and are not gated.",
|
||
"_prefix_resolution_note": "deferred_resolve_prefix_scaling_ratio is the one ratio not near 1, and the cause predates #3882. Resolution builds a namespace snapshot per Function scope (collectNamespaceTargets via createNamespaceTargetCache in scope-resolution/scope/), and each snapshot visits every namespace import of the file, so resolution costs O(functions x prefixed imports). It measures the same for `as p` (prefixed_resolve_prefix_scaling_ratio) and for `as p` on main, with identical graphs. The 2.2 budget allows 8.8x time for 4x input; it bounds growth at these sizes but does not prove linearity or exclude another superlinear term. See README.md and the retained sweep for the measured curves. Reassess the budget once snapshots can be shared across scopes that bind no import name.",
|
||
"_overhead_note": "deferred_to_prefixed_*_ratio divides the deferred large shape by the same workload spelled `as p`. Resolution measures about 1.00: same graph, same path. Capture measures about 1.15 because the deferred source carries one more statement per use (`await p<i>.loadLibrary();`); the deferred-prefix filter itself is one pass over the file's captures and runs only when the file has a deferred import.",
|
||
"_negative_controls_note": "Rebuilding the deferred-prefix set from all captures for every capture (O(captures^2), a temporary edit of languages/dart/captures.ts) fails three gates in the CI profile with unchanged fingerprints: deferred_to_prefixed_capture_ratio 2.054 > 2, deferred_capture_prefix_scaling_ratio 1.573 > 1.5 and deferred_capture_use_scaling_ratio 1.63 > 1.5. At the earlier 16/64 shapes the same edit gave 2.866 / 1.944 / 1.909. Testing each prefix separately (O(captures x prefixes), one Set per prefix) moved nothing measurable (1.119 / 1.135 / 1.222 at 16/64): that is below what this gate resolves. These are deliberate regressions, not baseline observations.",
|
||
"_profiles_note": "Two profiles share the shapes and every accuracy gate. CI (the default, and what --check runs in the benchmarks job): one process prepares all six workloads and times the three deferred shapes plus the as-p control at large, min of 5 after 1 warmup, interleaved; 18.3, 18.9, 19.2 s locally (macOS arm64). --full: one child times all six workloads, min of 15 after 2 warmups, and each shape runs in a fresh child for its peak RSS; about 1 minute. The prefixed_* scaling ratios and peak RSS exist only in --full. CI #3910 run 1 used the full protocol by default and took 3m10s, which pushed the 30-minute benchmarks job past its timeout.",
|
||
"_measured_ci": {
|
||
"environment": "macOS arm64 / Node 24.16.0, 2026-11-13, shared host (load average 9-14 on 15 cores)",
|
||
"wall_seconds": [18.26, 18.88, 19.18],
|
||
"reps": 5,
|
||
"warmup": 1,
|
||
"deferred_capture_prefix_scaling_ratio": 1.102,
|
||
"deferred_capture_prefix_scaling_ratio_samples": [1.02, 1.102, 1.082],
|
||
"deferred_capture_use_scaling_ratio": 1.151,
|
||
"deferred_capture_use_scaling_ratio_samples": [1.013, 1.151, 1.093],
|
||
"deferred_resolve_prefix_scaling_ratio": 1.552,
|
||
"deferred_resolve_prefix_scaling_ratio_samples": [1.436, 1.396, 1.552],
|
||
"deferred_resolve_use_scaling_ratio": 1.118,
|
||
"deferred_resolve_use_scaling_ratio_samples": [0.973, 1.118, 1.02],
|
||
"deferred_to_prefixed_capture_ratio": 1.142,
|
||
"deferred_to_prefixed_capture_ratio_samples": [1.043, 1.142, 1.14],
|
||
"deferred_to_prefixed_resolve_ratio": 1.025,
|
||
"deferred_to_prefixed_resolve_ratio_samples": [1.025, 0.949, 0.974],
|
||
"deferred_small_capture_ms": 76.5,
|
||
"deferred_small_resolve_ms": 11.4,
|
||
"deferred_large_capture_ms": 331.0,
|
||
"deferred_large_resolve_ms": 70.8,
|
||
"deferred_dense_capture_ms": 334.4,
|
||
"deferred_dense_resolve_ms": 46.6,
|
||
"prefixed_large_capture_ms": 293.1,
|
||
"prefixed_large_resolve_ms": 72.8
|
||
},
|
||
"_measured_full": {
|
||
"environment": "macOS arm64 / Node 24.16.0, 2026-11-13, shared host (load average 9-14 on 15 cores)",
|
||
"reps": 15,
|
||
"warmup": 2,
|
||
"deferred_capture_prefix_scaling_ratio": 1.178,
|
||
"deferred_capture_prefix_scaling_ratio_samples": [1.178, 1.027],
|
||
"deferred_capture_use_scaling_ratio": 1.163,
|
||
"deferred_capture_use_scaling_ratio_samples": [1.163, 1.069],
|
||
"deferred_resolve_prefix_scaling_ratio": 1.474,
|
||
"deferred_resolve_prefix_scaling_ratio_samples": [1.474, 1.315],
|
||
"deferred_resolve_use_scaling_ratio": 1.052,
|
||
"deferred_resolve_use_scaling_ratio_samples": [1.052, 0.88],
|
||
"prefixed_capture_prefix_scaling_ratio": 1.138,
|
||
"prefixed_capture_prefix_scaling_ratio_samples": [1.047, 1.138],
|
||
"prefixed_capture_use_scaling_ratio": 1.128,
|
||
"prefixed_capture_use_scaling_ratio_samples": [0.955, 1.128],
|
||
"prefixed_resolve_prefix_scaling_ratio": 1.396,
|
||
"prefixed_resolve_prefix_scaling_ratio_samples": [1.396, 1.381],
|
||
"prefixed_resolve_use_scaling_ratio": 0.988,
|
||
"prefixed_resolve_use_scaling_ratio_samples": [0.988, 0.96],
|
||
"deferred_to_prefixed_capture_ratio": 1.162,
|
||
"deferred_to_prefixed_capture_ratio_samples": [1.162, 1.143],
|
||
"deferred_to_prefixed_resolve_ratio": 1.02,
|
||
"deferred_to_prefixed_resolve_ratio_samples": [1.02, 0.988],
|
||
"deferred_small_capture_ms": 75.8,
|
||
"deferred_small_resolve_ms": 11.9,
|
||
"deferred_small_peak_rss_mib": 272.1,
|
||
"deferred_large_capture_ms": 357.1,
|
||
"deferred_large_resolve_ms": 70.1,
|
||
"deferred_large_peak_rss_mib": 409.6,
|
||
"deferred_dense_capture_ms": 352.4,
|
||
"deferred_dense_resolve_ms": 50.0,
|
||
"deferred_dense_peak_rss_mib": 401.1,
|
||
"prefixed_small_capture_ms": 73.4,
|
||
"prefixed_small_resolve_ms": 12.3,
|
||
"prefixed_small_peak_rss_mib": 265.8,
|
||
"prefixed_large_capture_ms": 307.4,
|
||
"prefixed_large_resolve_ms": 68.7,
|
||
"prefixed_large_peak_rss_mib": 374.6,
|
||
"prefixed_dense_capture_ms": 280.5,
|
||
"prefixed_dense_resolve_ms": 48.6,
|
||
"prefixed_dense_peak_rss_mib": 341.2
|
||
},
|
||
"_measured_note": "Three CI-profile and two --full runs of the 8/32 shapes. Scalar ratios and millisecond values are per-metric maxima across the runs of that profile (rounded). peak_rss_mib is each --shape child's high-water mark after one worker parse and one resolution, worker thread included; context, not gated. Exact shapes and fingerprints were identical in all runs. These profile measurements are separate from the retained Linux 16–256 sweep documented in README.md."
|
||
}
|