Skip to content

ilyalesokhin-starkware/scarb-burn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scarb Burn

Scarb extension for generating Cairo flame charts and pprof profiles.

image

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.

Installation

You need to have Rust installed on your machine.

cargo install --git https://github.com/m-kus/scarb-burn scarb-burn

Usage

Run 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

Output Types

  • flamegraph: Interactive SVG visualization, no additional dependencies required
  • pprof: Google's profiling format, requires Go toolchain for visualization but provides more analysis tools

Notes

  • Only main entrypoint 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 execute but not with scarb 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-browser opens SVG directly for flamegraphs, starts pprof web UI on port 8000 for pprof files
  • --no-build flag to skip rebuilding the package

Arguments Format

Arguments can be provided via file (--arguments-file) or command line (--arguments):

["0x1234", "0x5678"]  // arguments.json example

Note that main executable wrapper has a single argument of type Array<felt252> containing inner arguments serialized with Cairo Serde.

About

🔥 Scarb extension for generating Cairo flamegraphs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%