rust-profiling

Generate flamegraphs and analyze CPU and allocation hotspots in Rust binaries.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/awfixers-stuff/opencode-config --skill rust-profiling-awfixers-stuff
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-profiling
Source: https://github.com/awfixers-stuff/opencode-config/tree/main/skills/rust-profiling
Command: npx skills add https://github.com/awfixers-stuff/opencode-config --skill rust-profiling-awfixers-stuff

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Help developers find and understand performance and size hotspots in Rust projects by guiding profiling workflows, interpreting results, and recommending mitigations to reduce CPU time, allocation overhead, and binary bloat.

Core Features & Use Cases

  • Flamegraphs: Instructions for generating and customizing flamegraphs using cargo-flamegraph or perf to identify hot call paths.
  • Binary size analysis: Use cargo-bloat to discover large functions and per-crate size contributions and cargo-llvm-lines to measure monomorphization expansion.
  • Microbenchmarking and regressions: Configure and run Criterion benchmarks, save baselines, and compare performance across changes.
  • Platform-specific tooling: Advice for perf, heaptrack, and Valgrind on Linux and DTrace-based profiling on macOS, plus build flags and RUSTFLAGS recommendations.

Quick Start

Generate a flamegraph for your release-with-debug build using cargo flamegraph and open the produced SVG to inspect hotspots.

Frequently Asked Questions about rust-profiling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a flamegraph for a Rust binary to find CPU hotspots?

Generate a Rust flamegraph by building release artifacts with debug symbols and running cargo-flamegraph to sample execution, which produces an SVG visualizing hot call paths to pinpoint CPU hotspots.

What's the best way to analyze Rust binary size and monomorphization expansion?

Analyze Rust binary size by running cargo-bloat to discover large functions and per-crate size contributions, and use cargo-llvm-lines to measure monomorphization expansion and reduce binary bloat.

How do I run Criterion microbenchmarks to detect Rust performance regressions?

Run Criterion microbenchmarks to detect Rust performance regressions by configuring benchmarks, saving baselines, and comparing performance across code changes to measure execution time differences.

Does Rust profiling with perf and heaptrack work on both Linux and macOS?

Rust profiling with perf and heaptrack works on Linux, while macOS requires DTrace-based profiling. Both platforms need appropriate system permissions for sampling and release builds with debug symbols.

Why do I need RUSTFLAGS for frame pointers when profiling Rust applications?

You need RUSTFLAGS for frame pointers when profiling Rust applications to ensure accurate call stack sampling, allowing perf and cargo-flamegraph to correctly attribute CPU time to specific functions.

How do I interpret cargo-bloat results to reduce Rust binary size?

Interpret cargo-bloat results by identifying large functions and per-crate size contributions, then apply mitigations to reduce allocation overhead and binary bloat by optimizing or removing heavy dependencies.