What problem does it solve?
Rspack contributors working on performance issues often lack a systematic method for identifying which internal data structures dominate a hot path, leading to optimizations that target low-cardinality structures while ignoring dependencies and export infos that are orders of magnitude more numerous.
Core Features & Use Cases
- Cardinality-driven analysis: Ranks internal structures (dependency/export_info > module > chunk > chunk_group > entry/runtime) to focus optimization effort where full scans and repeated traversals are most dangerous.
- CPU optimization techniques: Covers caching stable results, avoiding repeated traversal, fast paths for common cases, deferred work, batched state updates, algorithmic complexity reduction, and dispatch overhead reduction.
- Memory optimization techniques: Covers string churn reduction, cloning avoidance, temporary container reduction, key-shape-appropriate data structures, and keeping hot structs small.
- Validation and PR workflow: Enforces running unit tests, formatters, and clippy, then guides creating a perf/ branch, conventional perf commit, PR, and triggering the Ecosystem Benchmark workflow with regression analysis.
- Use Case: A contributor notices slow incremental rebuilds on a large project; the skill guides them to profile the dependency graph traversal, add a reverse index, batch graph updates, validate with pnpm run test:unit, and open a benchmarked perf PR.
Quick Start
Use $rspack-perf to analyze and optimize the slow compilation stage I describe, following its cardinality model and validation steps.