Scarb extension for generating Cairo flame charts and pprof profiles.
This is a complementary tool to cairo-profiler, focused on generic Cairo programs run outside of Starknet context. It is particularly useful if you have a program that consumes a large arguments file.
You need to have Rust installed on your machine.
cargo install --git https://github.com/m-kus/scarb-burn scarb-burnRun in your project directory:
# Generate flamegraph (default)
scarb burn --arguments-file arguments.json --output-file flamegraph.svg --open-in-browser
# Generate pprof profile (requires Go toolchain for visualization)
scarb burn --output-type pprof --output-file profile.pb.gz --arguments-file arguments.json --open-in-browser- flamegraph: Interactive SVG visualization, no additional dependencies required
- pprof: Google's profiling format, requires Go toolchain for visualization but provides more analysis tools
- Only
mainentrypoint wrapped with#[executable]attribute is supported, you also have to have[lib]target in Scarb.toml so that a Sierra file is generated - Arguments format is compatible with
scarb executebut not withscarb cairo-run - User and corelib as well as libfuncs are counted, providing the most detailed info
- Loops and recursive calls are collapsed to improve readability
--open-in-browseropens SVG directly for flamegraphs, starts pprof web UI on port 8000 for pprof files--no-buildflag to skip rebuilding the package
Arguments can be provided via file (--arguments-file) or command line (--arguments):
["0x1234", "0x5678"] // arguments.json exampleNote that main executable wrapper has a single argument of type Array<felt252> containing inner arguments serialized with Cairo Serde.
