원클릭으로
forge-flamegraph-profiling
Profile Solidity gas with Foundry flamegraphs and harness tests.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Profile Solidity gas with Foundry flamegraphs and harness tests.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | forge-flamegraph-profiling |
| description | Profile Solidity gas with Foundry flamegraphs and harness tests. |
Use this skill to profile execution gas inside the EVM with Foundry in a way that is fast, reproducible, and useful for optimization work. This is not total transaction gas — use the tx-gas benchmarking skill for that.
Start with the gasleft() harness tests to identify the expensive phase, then generate a focused flamegraph for that phase and parse the SVG titles programmatically.
For the typed verifier path:
forge test --match-test testGasWhirVerifyFixed -vv
If the branch contains multiple suites with that test name, qualify it further with --match-contract or --match-path.
For the native blob verifier path:
forge test --match-test testGasWhirVerifyBlobNativeFixed -vv
forge test --match-test testProfileFullBreakdown -vv
forge test --match-test testProfileStirBreakdown -vv
forge test --match-test testProfileStirMicro -vv
--flamegraph first. It is aggregated by function and answers "where does total gas go?"--flamechart only after the hotspot is known and you need call ordering or sequencing.For this repo, run from sol-spartan-whir/. Prefer focused harness tests or synthetic tests over a full-path verifier test, because fixture loading adds noise.
Example:
forge test --match-test testFlameFinalStir --flamegraph
--flamegraph requires exactly one matching test. If the filter matches more than one suite, add --match-contract or --match-path.
view_image on SVG flamegraphs.<title> tags into both flamegraphs and flamecharts.To parse every cache/flamegraph_*.svg artifact:
python3 .agents/skills/forge-flamegraph-profiling/scripts/parse_flamegraphs.py
To parse a specific SVG:
python3 .agents/skills/forge-flamegraph-profiling/scripts/parse_flamegraphs.py \
cache/flamegraph_WhirGasProfileTest_testProfileStirBreakdown.svg
Use --limit N to change the number of rows printed per SVG.
gasleft() harness is the canonical phase-level breakdown.The main profiling surface lives in the test/WhirGasProfile*.t.sol harness family.
Use these tests as the standard entrypoints:
testGasWhirVerifyFixed: single canonical gas numbertestProfileFullBreakdown: setup, sumchecks, STIR, constraints, final checktestProfileStirBreakdown: per-round STIR internalstestProfileStirMicro: micro-benchmarks for leaf hashing, node compression, KoalaBear.pow, and query samplingPrefer focused flamegraphs for one phase at a time. Tests that call _loadSuccessFixture() include measurable harness noise.
Use this order when profiling an optimization candidate:
forge test.Do not hardcode gas numbers into the skill. Always measure the current branch.