Commit 251b2c4
authored
* fix(perf): scope WASM grammar load in engine-parity backfill
The native engine drops files in some build environments (#1054), triggering
a WASM backfill via the worker pool. The pool's first-call overhead is fine
for full builds (amortized over hundreds of files) but dwarfs the actual
parse work for small backfill batches — on slow CI runners, ~1.7s for 4
fixture files in one language.
Add `parseFilesWasmInline`: a main-thread, no-worker parse path that loads
only the grammars matching the input extensions and returns symbols with
`_tree` set so the unified walker in `runAnalyses` populates AST/CFG/dataflow
data downstream. New `parseFilesWasmForBackfill` chooses inline for batches
≤ 16 files, keeping worker isolation for larger batches where tree-sitter
WASM crash protection matters more (#965).
Routes both backfill sites through the new helper:
- `parseFilesAuto`'s per-call inline backfill in `domain/parser.ts`
- `backfillNativeDroppedFiles` in `domain/graph/builder/pipeline.ts`
Refs #1054
Impact: 4 functions changed, 13 affected
* fix(perf): free WASM trees after inline backfill (#1058)
The inline backfill path sets symbols._tree (live web-tree-sitter Tree
backed by WASM linear memory) on every result, but those symbols are
consumed locally for DB row construction in backfillNativeDroppedFiles
and never added to ctx.allSymbols, so the finalize-stage releaseWasmTrees
sweep never frees them. Without explicit cleanup, trees leak WASM memory
until process exit — bounded per run but cumulative across in-process
integration tests.
Adds a cleanup loop after batchInsertNodes that mirrors releaseWasmTrees,
and drops the now-unused parseFilesAuto import.
* docs(parser): explain INLINE_BACKFILL_THRESHOLD rationale (#1058)
Adds context for the 16-file threshold per Claude review feedback:
sized for typical engine-parity drops (recurring HCL case is 4 files);
above it, the worker-pool's IPC + crash-isolation cost is amortized over
enough parse work to be worth paying; below it, the cold-start dominates.
1 parent 1e292ef commit 251b2c4
2 files changed
Lines changed: 89 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
796 | | - | |
| 796 | + | |
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
| |||
853 | 853 | | |
854 | 854 | | |
855 | 855 | | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
856 | 877 | | |
857 | 878 | | |
858 | 879 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1067 | 1067 | | |
1068 | 1068 | | |
1069 | 1069 | | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
1070 | 1135 | | |
1071 | 1136 | | |
1072 | 1137 | | |
| |||
1117 | 1182 | | |
1118 | 1183 | | |
1119 | 1184 | | |
1120 | | - | |
| 1185 | + | |
1121 | 1186 | | |
1122 | 1187 | | |
1123 | 1188 | | |
| |||
0 commit comments