.agents/skills/profile/SKILL.md
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`.
npx skillsauth add acornprover/acorn 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 or verifier. The goal is a top-down summary that shows where sampled time is going.
acorn repo root.profile_reprove or profile_check.perf, cargo install samply, or profile recording is blocked, request escalated permissions instead of working around it.PROFILE.md in the repo root.If a profiling run fails because certificate checking fails, the run is not a valid performance baseline.
When that happens:
PROFILE.mdprofile_reprove: reprove real.double_sum, a representative prover workloadprofile_check: check-mode workloadPROFILE.mdPROFILE.md is the persistent record of the latest successful profiling baseline for each profiling target. Keep it updated after every successful profiling run.
The file should have a separate section for each profile script:
profile_reproveprofile_checkWhen you profile one target successfully, update that target's section with the latest run instead of leaving stale data in place.
Each section should include at least:
Check the platform first:
uname -s
perf workflowsamply workflowperf workflowFrame 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
perfrm -f perf.data
perf record -g --call-graph fp -o perf.data target/fastdev/profile_TARGET
Exit code 1 can be expected; the profiled program may exit with an error.
Inclusive-time breakdown:
perf report -i perf.data --stdio --percent-limit 0.5 2>&1 | grep -A 2000 "Samples: [0-9]*K" | head -300
Self-time breakdown:
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
samply workflowInstall samply once:
cargo install samply
Replace TARGET with reprove or check.
cargo build --bin=profile_TARGET --profile=fastdev
samplyrm -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 as JSON without opening a browser. --unstable-presymbolicate also writes the .syms.json file needed for symbol resolution.
python3 .agents/skills/profile/scripts/analyze_profile_topdown.py profile.json.gz
The script produces a top-down call tree and automatically uses the adjacent .syms.json file when present.
Always present a top-down tree showing logical phases.
The tree should:
Verifier::runprofile_checkTop-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 should make the main costs obvious at each level, such as certificate checking, copy-on-write overhead, or fact insertion.
scripts/analyze_profile_topdown.py: primary output format for samply profilesscripts/analyze_profile.py: flat self-time and inclusive-time listsprofile_reprove phase hintsFor profile_reprove, common prover phases include:
PassiveSet::simplify: subsumption checksPassiveSet::push_batch: adding clauses and building the fingerprint indexActiveSet::activate: generating inferences such as resolution and rewritingActiveSet::simplify: forward simplificationdevelopment
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.
tools
Profile the prover and generate a top-down performance summary
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