rspack-sftrace
Trace Rspack Rust function calls using LLVM XRay for performance analysis, troubleshooting, and visualization of execution flow.
Introduction
The rspack-sftrace skill provides a structured methodology for profiling the Rust-based core of the Rspack bundler. By leveraging LLVM XRay instrumentation, this tool captures granular details of function entry and exit points, enabling developers to identify performance bottlenecks, understand complex execution flows, and troubleshoot latency issues within the build process. It is primarily designed for Rspack contributors and performance engineers working within the monorepo environment.
The tool facilitates a complete diagnostic pipeline, from binary instrumentation to visual analysis. Users can generate filtered logs to isolate specific function symbols, significantly reducing noise in large-scale builds. The workflow includes data conversion utilities that translate raw logs into Polars dataframes for statistical analysis or Perfetto-compatible protobuf formats for high-fidelity visual tracing. This allows for the identification of hot paths, recursive function overhead, and thread-specific execution patterns.
-
Instrumentation of Rust function calls via LLVM XRay for precise timing data.
-
Advanced filtering capabilities to target specific function symbols using regex or list-based matching.
-
Support for exporting trace data to Polars for programmatic analysis, including grouping by function ID and calculating execution duration.
-
Conversion of trace artifacts to Perfetto protobuf format for integration with visualizers like VizTracer.
-
Thread-aware profiling to capture concurrent execution patterns typical in modern high-performance build tools.
-
The tool expects the target to be built with instrumentation enabled (SFTRACE=1).
-
Best performance results are achieved when running in the project's example directories.
-
Note that filtering does not automatically preserve descendant calls; for full call stacks, perform unfiltered captures when possible.
-
Ensure the environment has the necessary native dependencies and binary tools (sftrace) pre-installed and available in the PATH.
-
Trace logs can grow large; store artifacts in project-local directories to avoid system-wide storage exhaustion.
Repository Stats
- Stars
- 12,667
- Forks
- 794
- Open Issues
- 189
- Language
- Rust
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- May 3, 2026, 09:35 AM