The walker (lib/walker.ts, ~1,300 lines) is responsible for resolving the full dependency tree via static analysis (Babel parser for AST detection, glob expansion, patch application). On large projects it can be a significant bottleneck.
Areas to investigate
- Leverage existing bundlers — Research whether esbuild, Rolldown, or other fast bundlers can replace or supplement the custom walker for dependency resolution. They already solve the "find all imports" problem and are significantly faster.
- Parallelism — The walker steps (
stepRead → stepStrip → stepDetect → stepExpand → stepPatch) are currently sequential per file. Investigate whether worker threads could parallelize file processing.
- Native rewrite — If JS-level optimizations hit a ceiling, explore rewriting the hot paths (AST parsing, file I/O) in Rust via napi-rs or a similar approach.
Acceptance criteria
Measurable improvement on a real-world project (e.g. zwave-js-ui) with before/after benchmarks.
Part of #235
The walker (
lib/walker.ts, ~1,300 lines) is responsible for resolving the full dependency tree via static analysis (Babel parser for AST detection, glob expansion, patch application). On large projects it can be a significant bottleneck.Areas to investigate
stepRead→stepStrip→stepDetect→stepExpand→stepPatch) are currently sequential per file. Investigate whether worker threads could parallelize file processing.Acceptance criteria
Measurable improvement on a real-world project (e.g. zwave-js-ui) with before/after benchmarks.
Part of #235