Skip to content

perf: speed up the dependency walker #239

@robertsLando

Description

@robertsLando

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

  1. 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.
  2. Parallelism — The walker steps (stepReadstepStripstepDetectstepExpandstepPatch) are currently sequential per file. Investigate whether worker threads could parallelize file processing.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions