Quick start
Generate an interactive flamegraph for any transaction:<tx-hash>.flamegraph.html
By default, flamegraphs are exported as interactive HTML. Open the file in any modern browser to explore.
Export formats
Erst supports two flamegraph formats:Format comparison
| Feature | HTML | SVG |
|---|---|---|
| Interactive | ✅ Yes | ❌ No |
| Hover tooltips | ✅ Yes | ❌ No |
| Click-to-zoom | ✅ Yes | ❌ No |
| Search/highlight | ✅ Yes | ❌ No |
| Dark mode | ✅ Auto | ✅ Manual |
| File size | Larger | Smaller |
| External dependencies | None | None |
| Browser required | Yes | No |
| Vector editors | ❌ No | ✅ Yes |
Interactive features
Hover tooltips
Move your mouse over any frame to see detailed information:- Function name
- File location
- Duration (microseconds)
- Percentage of total time
- Call depth
Click-to-zoom
Click any frame to zoom into that section of the flamegraph:The view zooms to show only that function and its children, making deeply nested calls easier to analyze.
Zooming doesn’t change the data - it just filters the view. All percentages remain relative to the total execution time.
Search and highlight
Find specific functions quickly:Responsive design
The interactive flamegraph adapts to:- Different viewport sizes (desktop, tablet, mobile)
- Light and dark color schemes (automatic detection)
- High-DPI displays
Understanding flamegraphs
Reading the visualization
Flamegraphs are read from bottom to top:- Width: Represents time or memory consumed (wider = more resources)
- Height: Call stack depth (higher = more nested calls)
- Color: Different colors distinguish different functions (no semantic meaning)
- Flat vs stacked: Flat frames are time spent in that function directly; stacked frames include children
Performance analysis
Use flamegraphs to identify:Hot paths
Hot paths
Look for wide frames - these consume the most resources. If a frame spans most of the width, that function or its children are the bottleneck.Action: Focus optimization efforts on these wide functions.
Deep call stacks
Deep call stacks
Tall stacks indicate many nested function calls. Deep recursion or excessive abstraction layers can impact performance.Action: Consider flattening call hierarchies or using iterative approaches.
Repeated patterns
Repeated patterns
If you see the same function name repeated many times at the same level, that function is called multiple times in sequence.Action: Look for opportunities to batch operations or cache results.
Unexpected functions
Unexpected functions
Surprising functions appearing in hot paths may indicate:
- Inefficient library usage
- Unnecessary conversions or copies
- Debug code left in release builds
Common workflows
Profile a specific transaction
Compare network behavior
Profile the same transaction on different networks:Profile local WASM
Test contract performance during development:Export for sharing
Dark mode support
Both HTML and SVG formats automatically adapt to your system’s color scheme: Light mode:- Light background (#ffffff)
- Dark text (#000000)
- Vibrant frame colors
- Dark background (#1e1e2e)
- Light text (#cdd6f4)
- Adjusted frame colors for contrast
Standalone files
HTML flamegraphs are completely self-contained:- All CSS inlined in
<style>block - All JavaScript inlined in
<script>block - SVG embedded directly
- No external dependencies
- No network requests
- Works offline
- Email the HTML file
- Store it in version control
- Host it on any web server
- Open it directly from disk
Browser compatibility
Interactive HTML flamegraphs work in:- Chrome/Edge 88+
- Firefox 78+
- Safari 14+
- Opera 74+
Older browsers may display the flamegraph but interactive features might not work.
Technical details
Implementation
Flamegraph generation is located ininternal/visualizer/flamegraph.go:
GenerateInteractiveHTML()- Wraps SVG in interactive HTMLExportFlamegraph()- Main export functionExportFormat- Enum for format selectionGetFileExtension()- Returns appropriate extension
File extensions
- HTML format:
.flamegraph.html - SVG format:
.flamegraph.svg
.gitignore when running erst init.
Performance
Flamegraph generation is fast:- Small transactions (< 100 frames): < 50ms
- Medium transactions (100-1000 frames): < 200ms
- Large transactions (> 1000 frames): < 1s
Optimization tips
Reduce flamegraph complexity
If your flamegraph is too large to analyze:- Filter by time threshold: Focus on frames taking > 1% of total time
- Zoom into hot paths: Use click-to-zoom to focus on expensive sections
- Search for specific functions: Use search to isolate particular concerns
Integrate with CI/CD
Automate performance regression detection:Troubleshooting
Empty flamegraph
- Ensure the transaction executed successfully
- Check that your RPC supports diagnostic events
- Try with
--verboseto see what data is available
Flamegraph too small
If text is unreadable:- Use browser zoom (Ctrl/Cmd +
+) - Click frames to zoom into specific sections
- Export as SVG and open in a vector graphics editor
JavaScript errors in browser
Check browser console (F12) for errors:- Ensure you’re using a supported browser version
- Try opening in a different browser
- Verify the HTML file wasn’t corrupted during transfer