| name | sp1-profiling |
| description | Profile an SP1 zkVM program to find cycle-count hotspots. Use when the user asks to profile, find bottlenecks, see "where cycles go", or analyze performance of an SP1 program. Covers enabling the profiler, running it, and interpreting the Firefox-Profiler-format JSON without needing samply. |
| allowed-tools | Read, Grep, Glob, Bash, Edit, Write |
Profiling SP1 programs
SP1's profiler captures per-function cycle counts using the program's DWARF debug info and writes a Firefox-Profiler-format JSON. Each "sample" in the output is one RISC-V cycle, so sample counts equal cycle counts exactly.
Reference: https://docs.succinct.xyz/docs/sp1/optimizing-programs/profiling
When to use this skill
- User asks to profile an SP1 program / find hotspots / analyze cycles.
- User wants to know where the bulk of
total_instruction_count() is spent.
- User wants to validate a precompile is being used (e.g. Keccak, secp256k1, BN254).
When not to use it
- Just measuring total cycles → call
client.execute(...) and read report.total_instruction_count(). Don't enable profiling.
- Measuring proving time / GPU throughput → that's a separate benchmark, not profiling.
Step 1 — Enable the profiling feature
In the script crate's Cargo.toml:
sp1-sdk = { version = "<your-version>", features = [, ...] }