rust-performance

Profile Rust CPU, memory, and build-time bottlenecks with criterion, perf, and flamegraph.

1|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/caraya/agent-skills --skill rust-performance-caraya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-performance
Source: https://github.com/caraya/agent-skills/tree/main/skills/rust-performance
Command: npx skills add https://github.com/caraya/agent-skills --skill rust-performance-caraya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Profiling Rust applications to uncover CPU, memory, and build-time bottlenecks, guiding targeted optimizations and faster runtimes.

Core Features & Use Cases

  • Benchmarking: Use criterion for statistically sound micro-benchmarks.
  • CPU profiling: Leverage perf, Instruments, and flamegraph to locate hot code paths.
  • Memory and allocations: Analyze heap usage with heaptrack, dhat, and jemalloc stats to reduce allocations and fragmentation.
  • Compilation performance: Inspect build times with cargo timings and optimize for faster cargo builds in large workspaces.
  • Use cases include profiling latency-sensitive services, reducing memory footprints, and speeding up long-lived Rust projects.

Quick Start

Run a benchmark with criterion on a Rust project to begin profiling hot paths.

Frequently Asked Questions about rust-performance

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

FAQPage Schema
How do I profile Rust performance to find CPU bottlenecks?

Profile Rust performance using perf and flamegraph tooling to measure CPU behavior and locate hot code paths. This identifies hot code paths to guide targeted optimizations for latency-sensitive services.

What is the best way to benchmark Rust code for statistical accuracy?

Benchmarking Rust code with criterion provides statistically sound micro-benchmarks. Criterion measures performance variations reliably, ensuring your hot-path optimizations are based on accurate runtime data rather than noise.

How can I reduce memory allocations and heap usage in my Rust application?

Reduce memory allocations by analyzing heap usage with heaptrack, dhat, and jemalloc stats. These tools identify excessive allocations and fragmentation, guiding targeted memory footprint reduction in long-lived Rust projects.

Why does my Rust build take so long in large workspaces and how do I fix it?

Diagnose slow Rust builds in large workspaces by inspecting compilation performance with cargo timings. This tool breaks down build times to identify bottlenecks and guide optimizations for faster cargo builds.

Do I need specific tools to measure Rust build-time behavior and runtime performance?

Measuring Rust build-time and runtime performance requires the Rust toolchain alongside criterion, perf, flamegraph tooling, and cargo-timings. These dependencies gather CPU, memory, and compilation measurements to generate meaningful reports.

Can I use flamegraph and perf to optimize hot paths in Rust services?

Flamegraph and perf are used to optimize hot paths in Rust services by visualizing CPU usage. They generate reports that reveal exactly where execution time accumulates, enabling targeted end-to-end performance optimization.