.claude/skills/profile/SKILL.md
Profile the prover and generate a top-down performance summary
npx skillsauth add acornprover/acorn .claude/skills/profileInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when the user asks to profile the Acorn prover. This generates a top-down summary showing where time is spent.
profile_reprove - Profiles reproving real.double_sum module (representative prover workload)profile_check - Profiles check modeAsk the user which target to profile if not specified.
If a profiling run hits a certificate-check failure, stop immediately and report it.
PROFILE.md.PROFILE.mdAfter every successful profiling run, update PROFILE.md in the repo root.
Keep one section per profile script:
profile_reproveprofile_checkFor the target you just profiled successfully, replace stale results with the latest run details. Include the date, git hash, machine summary, exact command, runtime numbers, and a brief summary of the top-down breakdown so later runs can be compared for regressions.
Check the platform first:
uname -s
Frame pointers are required for accurate call graph profiling. Replace TARGET with reprove or check:
RUSTFLAGS="-C force-frame-pointers=yes" cargo build --bin=profile_TARGET --profile=fastdev
rm -f perf.data && perf record -g --call-graph fp -o perf.data target/fastdev/profile_TARGET
The exit code 1 is expected (the profiled program may exit with error).
Get the inclusive time breakdown (with call graph):
perf report -i perf.data --stdio --percent-limit 0.5 2>&1 | grep -A 2000 "Samples: [0-9]*K" | head -300
Get self-time breakdown for the main event:
perf report -i perf.data --stdio --no-children --percent-limit 0.3 2>&1 | grep -A 500 "Samples: [0-9]*K" | grep -E '^\s+[0-9]+\.[0-9]+%' | head -50
Install samply (one-time):
cargo install samply
cargo build --bin=profile_TARGET --profile=fastdev
Replace TARGET with reprove or check.
rm -f profile.json.gz profile.json.syms.json && samply record --save-only --unstable-presymbolicate -o profile.json.gz target/fastdev/profile_TARGET
This saves the profile to JSON without opening a browser. The --unstable-presymbolicate flag generates a .syms.json file with symbol information needed for name resolution.
python3 .claude/skills/profile/analyze_profile_topdown.py profile.json.gz
This generates a top-down call tree showing where time is spent, automatically drilling down into any component >= 10%.
The script automatically uses the .syms.json file for symbol resolution.
Always present a top-down tree breakdown showing what logical phases take time. The tree should:
Verifier::run)profile_check:Top-Down Breakdown
============================================================
├── 93% Verifier::run
│ └── 88% Builder::build
│ └── 88% Builder::verify_module
│ ├── 74% Builder::verify_node
│ │ ├── 37% verify_goal
│ │ │ └── 36% Processor::check_cert
│ │ │ ├── 23% Checker::check_cert
│ │ │ │ └── 14% Certificate::to_concrete_proof
│ │ │ │ └── 8% cloning
│ │ │ └── 10% cloning
│ │ ├── 19% Rc::make_mut
│ │ │ └── 19% cloning
│ │ ├── 11% Processor::add_fact
│ │ │ └── 7% Checker::insert_clause
│ │ └── 7% Rc::drop_slow
│ └── 13% Processor::add_fact
└── 7% Verifier::new
This format makes it clear that:
verify_goal (certificate checking)Rc::make_mut (copy-on-write overhead)add_fact at the verify_node levelanalyze_profile.py - Self-time and inclusive-time flat lists (useful for seeing which individual functions are hot)analyze_profile_topdown.py - Top-down tree breakdown (primary output format)For profile_reprove, the main phases of the prover are:
PassiveSet::simplify - checking if clauses are subsumedPassiveSet::push_batch - adding new clauses, building fingerprint indexActiveSet::activate - generating inferences (resolution, rewriting)ActiveSet::simplify - forward simplificationtools
Use when asked to profile Acorn prover or verifier performance, investigate where time is spent, or generate a top-down runtime breakdown from `perf` or `samply`.
development
Use when a proof/module verifies in baseline mode but reproving under a prover-affecting feature flag fails. Add explicit proof detail based on the working baseline proof until `cargo run --features <feature> -- verify ...` succeeds.
development
Use when asked to migrate to a feature flag or roll out a manifest-gated acornlib certificate/build-cache or proof-format change. This skill covers feature-flag migrations, including the state-machine workflow for verifier, proof, and cache migrations.
databases
Install ONNX Runtime for the ort crate in a sandboxed environment