Skip to content

Commit a13ab45

Browse files
committed
fix(perf): add parser.ts to canary paths and free WASM tree on symbolsOnly inline path
Guard the inline-path optimization against regressions by adding src/domain/parser.ts to the perf-canary paths filter — without it the canary silently skips exactly the file this PR modifies. Also free the WASM-backed tree when symbolsOnly=true in parseFilesWasmInline. The tree was being parsed and then discarded without an explicit .delete() call, leaking WASM linear memory on every incremental rebuild that triggers the inline path. The deletion is guarded by a typeof check, matching the pattern used by the extractor-error path at line 1078.
1 parent d07b358 commit a13ab45

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/perf-canary.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919
paths:
2020
- "src/extractors/**"
2121
- "src/domain/graph/**"
22+
- "src/domain/parser.ts"
2223
- "crates/**"
2324
- "scripts/benchmark.ts"
2425
- "scripts/incremental-benchmark.ts"

src/domain/parser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,12 @@ async function parseFilesWasmInline(
12301230
// are needed by callers like the this/super dispatch post-pass.
12311231
if (!symbolsOnly) {
12321232
symbols._tree = extracted.tree;
1233+
} else if (typeof (extracted.tree as any)?.delete === 'function') {
1234+
// Free the WASM-backed tree immediately — web-tree-sitter trees are backed
1235+
// by WASM linear memory and require explicit disposal. When symbolsOnly is
1236+
// true the tree is never stored anywhere, so we must delete it here to
1237+
// avoid leaking WASM heap on every incremental rebuild.
1238+
(extracted.tree as any).delete();
12331239
}
12341240
symbols._langId = extracted.langId;
12351241
result.set(relPath, symbols);

0 commit comments

Comments
 (0)