From 84336600bb1138c4445177ff49c26f44dbbff38c Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sun, 8 Mar 2026 04:30:51 -0600 Subject: [PATCH] feat(benchmark): add 1-file rebuild phase breakdown to build benchmarks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Capture per-phase timing from incremental 1-file rebuilds and render them alongside the full-build phases in a single combined table. This makes it easy to see which phases scale down for incremental builds (e.g. parse drops from ~267ms to ~5ms) vs which stay constant. Also removes the obsolete wasmPreMs phase tracking — the WASM pre-parse is always 0ms now that CFG and dataflow run natively. Impact: 4 functions changed, 11 affected --- generated/benchmarks/BUILD-BENCHMARKS.md | 13 +++--- scripts/benchmark.js | 15 +++++-- scripts/incremental-benchmark.js | 16 ++++--- scripts/update-benchmark-report.js | 57 +++++++++++++++--------- src/builder.js | 5 --- 5 files changed, 63 insertions(+), 43 deletions(-) diff --git a/generated/benchmarks/BUILD-BENCHMARKS.md b/generated/benchmarks/BUILD-BENCHMARKS.md index a54e130d..0bef9861 100644 --- a/generated/benchmarks/BUILD-BENCHMARKS.md +++ b/generated/benchmarks/BUILD-BENCHMARKS.md @@ -150,14 +150,11 @@ remains at 6.6 ms/file (vs 5.0 in v2.0.0). The WASM/Native ratio widened from extractor is needed to recover the regression. **Native build regression (v3.0.0 4.4 ms/file → v3.0.3 12.3 ms/file):** The regression is entirely -from four new build phases added in v3.0.1 that are now default-on: AST node extraction (651ms), -WASM pre-parse (388ms), dataflow analysis (367ms), and CFG construction (169ms) — totalling ~1,575ms -of new work. The original seven phases (parse, insert, resolve, edges, structure, roles, complexity) -actually got slightly faster (728ms → 542ms). The WASM pre-parse phase exists because CFG, dataflow, -and complexity are implemented in JS and need tree-sitter AST trees to walk, but the native Rust engine -only returns extracted symbols — not AST trees. So on native builds, all 172 files get parsed twice: -once by Rust (85ms) and once by WASM (388ms). Eliminating this double-parse requires either implementing -CFG/dataflow in Rust, or having the native engine expose tree-sitter trees to JS. +from new build phases added in v3.0.1 that are now default-on: AST node extraction (651ms), +dataflow analysis (367ms), and CFG construction (169ms) — totalling ~1,187ms of new work. The original +seven phases (parse, insert, resolve, edges, structure, roles, complexity) actually got slightly faster +(728ms → 542ms). As of v3.1.0, CFG and dataflow run natively in Rust, eliminating the redundant WASM +pre-parse that previously added ~388ms on native builds.