Skip to content

Commit 2d79f18

Browse files
fix: preserve hand-written notes in benchmark report regeneration (#128)
Add NOTES_START/NOTES_END sentinel preservation to the benchmark updater so CI-triggered regenerations no longer clobber hand-written analysis sections. Also adds WASM regression notes to the benchmark report. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 72497dc commit 2d79f18

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

generated/BUILD-BENCHMARKS.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ Extrapolated linearly from per-file metrics above.
6262
|---------|--------|------------:|--------------:|----------:|----------:|
6363
| 2.4.0 | wasm | 1.8 | 1.4 | 0.8 | 0.8 |
6464

65+
<!-- NOTES_START -->
66+
### Notes
67+
68+
**WASM regression (v2.0.0 → v2.1.0, ↑32% — persists in v2.3.0):** The
69+
"v2.1.0" entry was measured after the v2.1.0 tag on main, when `package.json`
70+
still read "2.1.0" but the codebase already included post-release features:
71+
receiver field extraction (`b08c2b2`) and Commander/Express callback extraction
72+
(`2ac24ef`). Both added WASM-to-JS boundary crossings on every
73+
`call_expression` AST node. The native engine was unaffected because its Rust
74+
extractors have zero boundary overhead — and it gained a net 24% speedup from
75+
the ~45% edge reduction introduced by scoped call-resolution fallback
76+
(`3a11191`). For WASM the extra crossings outweighed the edge savings. A
77+
targeted fix in `d4ef6da` gated `extractCallbackDefinition` behind a
78+
`member_expression` type check and eliminated redundant `childForFieldName`
79+
calls, but the v2.3.0 CI benchmark confirms this was **insufficient** — WASM
80+
remains at 6.6 ms/file (vs 5.0 in v2.0.0). The WASM/Native ratio widened from
81+
2.0x to 3.5x. Further optimization of WASM boundary crossings in the JS
82+
extractor is needed to recover the regression.
83+
<!-- NOTES_END -->
84+
6585
<!-- BENCHMARK_DATA
6686
[
6787
{

scripts/update-benchmark-report.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,19 @@ if (hasQueries) {
200200
md += '\n';
201201
}
202202

203+
// ── Preserve hand-written notes from existing file ────────────────────
204+
let notes = '';
205+
if (fs.existsSync(benchmarkPath)) {
206+
const existing = fs.readFileSync(benchmarkPath, 'utf8');
207+
const notesMatch = existing.match(/<!-- NOTES_START -->\n([\s\S]*?)<!-- NOTES_END -->/);
208+
if (notesMatch) {
209+
notes = notesMatch[1];
210+
}
211+
}
212+
if (notes) {
213+
md += `<!-- NOTES_START -->\n${notes}<!-- NOTES_END -->\n\n`;
214+
}
215+
203216
md += `<!-- BENCHMARK_DATA\n${JSON.stringify(history, null, 2)}\n-->\n`;
204217

205218
fs.mkdirSync(path.dirname(benchmarkPath), { recursive: true });

0 commit comments

Comments
 (0)