Performance ​
- All performance issues (runtime and compilation speed) are considered as bugs in this project.
- Follow guidance from the Rust performance book.
Compile Time ​
While Rust has gained a reputation for its comparatively slower compilation speed, we have dedicated significant effort to fine-tune the Rust compilation speed.
Our goal is to minimize any impact on development workflow, ensuring that Oxc based tools remain fast to compile.
Our CI runs complete in 3 minutes, any regressions need to be fixed.
Profile ​
Heap Allocation ​
Try dhat.
CPU - Samply ​
Samply is a command line CPU profiler which uses the Firefox profiler as its UI. Works on macOS and Linux.
CPU - Mac Xcode Instruments ​
cargo instruments
is the tool of choice to bridge Mac Xcode instruments.
The following instruction replicates the procedure of cargo instruments
.
First, install Xcode Instruments command-line tools:
xcode-select --install
And then change the build profile to show debug symbols:
[profile.release]
debug = true # enable debug symbols
strip = false # do not strip symbols
Build the binary with --release
:
cargo build --release --bin oxlint --features allocator
Once the project is built, the binary is located at ./target/release/oxlint
.
Under the hood, cargo instruments
invokes the xcrun xctrace
command, which is equivalent to
xcrun xctrace record --template 'Time Profile' --output . --launch -- /path/to/oxc/target/release/oxlint
Running the command above produces the following output
Starting recording with the Time Profiler template. Launching process: oxlint.
Ctrl-C to stop the recording
Target app exited, ending recording...
Recording completed. Saving output file...
Output file saved as: Launch_oxlint_2023-09-03_4.41.45 PM_EB179B85.trace
Open the trace file open Launch_oxlint_2023-09-03_4.41.45\ PM_EB179B85.trace
.
To see a top down trace:
- On the top panel, click CPUs
- On the left input box, click
x
then selectTime Profiler
- At the bottom panel, click "Call Tree", turn on "Invert Call Tree" and turn off separate by thread.
For memory and disk operations, use --template 'Allocations'
and --template 'File Activity'
.