feat(benchmark): add 1-file rebuild phase breakdown#370
Conversation
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
|
Claude finished @carlos-alm's task —— View job PR Review CompleteTodo List:
Root Cause AnalysisProblem Being Solved: The benchmarking system lacked detailed timing breakdowns for incremental 1-file rebuilds, which is a critical performance metric for understanding real-world usage patterns. The existing system only captured total rebuild times without phase-level visibility. Why This Approach:
Risk Assessment: LOW RISK - This is purely additive benchmarking instrumentation with clean removal of dead code. Technical Implementation Review✅ Clean Code Removal (
|
Greptile SummaryThis PR extends the benchmark tooling to capture per-phase timing from the median incremental (1-file) rebuild run alongside full-build phase data, and removes the now-obsolete Changes:
The implementation correctly handles backward compatibility and conditional rendering based on data availability. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant B as benchmark.js / incremental-benchmark.js
participant BG as buildGraph (builder.js)
participant R as update-benchmark-report.js
Note over B: 1-file rebuild loop (INCREMENTAL_RUNS=3)
loop Each run i
B->>BG: buildGraph(root, { engine, incremental: true })
BG-->>B: { phases: { parseMs, insertMs, ... } }
B->>B: oneFileRuns.push({ ms, phases })
end
B->>B: sort by ms, pick index Math.floor(len/2)
B->>B: oneFileRebuildMs = medianRun.ms
B->>B: oneFilePhases = medianRun.phases
B->>B: JSON.stringify({ ..., phases (full build), oneFilePhases })
B->>R: pipe JSON output
R->>R: hasPhases = latest.native?.phases || latest.wasm?.phases
R->>R: hasOneFilePhases = latest.native?.oneFilePhases || latest.wasm?.oneFilePhases
alt hasPhases && hasOneFilePhases
R->>R: Render 4-column table (build + 1-file)
else hasPhases only
R->>R: Render 2-column table (build only)
else neither
R->>R: Skip phase section entirely
end
Last reviewed commit: 8433660 |
Summary
benchmark.jsandincremental-benchmark.jsNative (build) | WASM (build) | Native (1-file) | WASM (1-file)wasmPreMsphase tracking from builder and report generator — always 0ms now that CFG/dataflow run nativelyTest plan
node scripts/benchmark.jsand verifyoneFilePhasesappears in JSON output for both enginesnode scripts/update-benchmark-report.jsand verify the combined 4-column phase table renders correctlyoneFilePhases) falls back to the 2-column layout