| name | sftrace |
| description | Use sftrace, which is based on LLVM Xray instrumentation, to trace all Rust function calls. This can be used for performance analysis and troubleshooting. |
Rspack Resolver Sftrace
Overview
Use sftrace (LLVM XRay) to trace rspack-resolver's Rust function calls and convert them to perfetto protobuf format for performance analysis and troubleshooting.
Default workflow: run from the project root and store all trace artifacts in a sftrace-<timestamp> directory.
Workflow
1) Build sftrace tools
git clone https://github.com/quininer/sftrace
cd sftrace
cargo build --release
mkdir "$(./target/release/sftrace record --print-solib-install-dir)"
cp ./target/release/libsftrace.so "$(./target/release/sftrace record --print-solib-install-dir)/"
2) Build with XRay instrumentation
XRay instrumentation must be enabled via RUSTFLAGS. There are two targets: the Node.js binding and the Rust benchmark binary.
2a) Node.js binding
RUSTFLAGS="-Zinstrument-xray=always" pnpm build:binding:profiling
The .node binding file will be output to the project root (e.g. resolver.darwin-arm64.node).
2b) Benchmark binary
RUSTFLAGS="-Zinstrument-xray=always" cargo +nightly bench --profile profiling --no-run
The benchmark binary will be output under target/profiling/deps/. Find it with: