• Pack
  • Docs
  • Advanced
  • Profiling

Profiling Turbopack

On macOS

Install cargo-instruments

cargo-instruments version 0.4.7 is incompatible with our workspace setup, so to install it you'll need to clone it and install it from an updated branch:

git clone https://github.com/cmyr/cargo-instruments.git
git checkout update-deps
cargo install --path .

Make sure you have all the prerequisites for running cargo-instruments.

Run the profiler

By default, the next-dev CLI will keep watching for changes to your application and never exit until you manually interrupt it. However, cargo-instruments waits for your program to exit before building and opening the trace file. For this purpose, we've added a profile feature to next-dev which exits the program if no updates are detected within a given timeframe and there are no pending tasks.

To profile next-dev, run the following command:

cargo instruments -t time --bin next-dev --release --features profile [-- [...args]]

You can also run other templates than the time profiler.

Once the program exits, the profiler will open the trace file in Instruments. Refer to the learning resources to learn how to use Instruments.

An example trace from the time profiler.

On other platforms

We currently don't have a guide for profiling Turbopack on other platforms.

Last updated on 2022-11-14T09:26:39.000Z