rust-performance-optimization

Profile and optimize Rust applications using flamegraph, samply, and Criterion benchmarks.

Updated Jan 20, 2026
One-click install
npx skills add https://github.com/Davincible/GHOSTNET --skill rust-performance-optimization-davincible
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-performance-optimization
Source: https://github.com/Davincible/GHOSTNET/tree/main/.opencode/skill/rust-performance-optimization
Command: npx skills add https://github.com/Davincible/GHOSTNET --skill rust-performance-optimization-davincible

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust performance issues can silently degrade user experience; this Skill helps you measure, profile, and optimize code to remove bottlenecks and guarantee responsiveness.

Core Features & Use Cases

  • Measurement & Profiling: Collect CPU and memory usage, generate flamegraphs, and identify hot paths in Rust apps.
  • Benchmarking & Optimization: Use Criterion and Divan to benchmark changes, compare results, and drive optimizations with data.
  • Real-World Scenarios: Optimize hot code paths in long-running services, game loops, or high-throughput data pipelines, then validate improvements with PGO workflows and memory profiling.
  • Use case example: profile a Rust API server, find a slow serialization path, and rewrite it to reduce latency.

Quick Start

  • Install profiling tools (flamegraph, samply, etc.) and ensure debug symbols are available.
  • Build and run profiled binaries:
    • cargo build --release
    • cargo flamegraph --bin myapp -- --my-args
  • Run benchmarks and compare with baselines:
    • cargo bench
    • cargo bench -- --baseline main

Frequently Asked Questions about rust-performance-optimization

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

FAQPage Schema
How do I profile a Rust application to find slow functions?

Profile Rust applications by installing tools like flamegraph or samply with debug symbols enabled, then run cargo flamegraph --bin myapp to generate visual call graphs and identify hot paths.

What is the best way to benchmark Rust code changes?

Benchmark Rust code changes using Criterion or Divan to measure performance, compare results against baselines with cargo bench -- --baseline main, and verify optimizations with data.

How does PGO work for optimizing Rust binaries?

PGO workflows for Rust binaries collect profiling data from representative runs, then feed it back into the compiler to optimize hot paths and reduce latency in production builds.

Can I use this to optimize memory usage in long-running Rust services?

Yes, optimize memory usage in long-running Rust services using memory profiling tools like DHAT and Valgrind to detect allocations, identify bottlenecks, and validate improvements.

Why does my Rust release build still have high latency?

High latency in Rust release builds often stems from unoptimized hot code paths; use profiling tools to measure CPU usage, find slow serialization paths, and rewrite them.

Do I need debug symbols to generate a flamegraph in Rust?

Yes, generating a flamegraph in Rust requires debug symbols to map samples back to source code, ensuring accurate identification of hot paths during profiling.