a foundry plugin that generates interactive flamegraph for a test case. currently two backends are supported: calltrace and debugtrace.
lets forge some flamegraphs!
above is a debugtrace flamegraph of poseidon2 hash function.
cargo install --git https://github.com/zemse/forge-flamegraph
calltrace
suitable for complex contracts like defi protocols. generates flamegraph svg with the call trace.
forge-flamegraph -t NAME_OF_TEST_FUNCTION --open
debugtrace
suitable for libraries. generates flamegraph svg including solidity internal functions.
forge-flamegraph -t NAME_OF_TEST_FUNCTION --debugtrace --open
Note: source mappings from the solidity compiler aren’t that great, this plugin still tries to guess by looking at source mappings of adjacent steps but unfortunately it only works to some extent.
and ofcourse for so much oss used in this project