Build profiling
Running a performance analysis helps you identify bottlenecks in your project so you can optimize the right areas.
Using Rsdoctor
Rsdoctor is a build analyzer that visualizes how long each loader and plugin takes to compile.
See Use Rsdoctor for more information.
Node.js profiling
A build runs both JavaScript and Rust code and incurs communication overhead between them.
JavaScript overhead is usually higher than Rust overhead. Use Node.js profiling to understand where time is spent in JavaScript and pinpoint bottlenecks.
For example, to capture a CPU profile, run the following commands from your project root:
These commands generate a *.cpuprofile file. You can use speedscope to visualize it:
Rspack profiling
Set the RSPACK_PROFILE environment variable to capture an Rspack build performance profile.
Because Windows does not support this syntax, you can use cross-env to set environment variables across different systems:
By default, Rspack writes the profile output to stdout through the logger trace layer.
- When shutting down the dev server, press
CTRL + Dinstead ofCTRL + Cso Rspack can finish recording performance data. - For more information about Rspack profiling, refer to Rspack - Tracing.

