rust-performance-best-practices

Profile Rust applications to identify performance bottlenecks and apply optimization rules.

2|1|Updated Jan 17, 2026
One-click install
npx skills add https://github.com/mcart13/dev-skills --skill rust-performance-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-performance-best-practices
Source: https://github.com/mcart13/dev-skills/tree/main/skills/rust-performance-best-practices
Command: npx skills add https://github.com/mcart13/dev-skills --skill rust-performance-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust performance can be elusive and time-consuming to optimize without a structured, repeatable workflow. The guide provides a comprehensive, rule-based approach to identifying bottlenecks, applying targeted optimizations, and validating improvements across build profiles, allocations, concurrency, and I/O.

Core Features & Use Cases

  • 45+ rules across 9 categories covering build profiles, allocation strategies, data structures, iteration patterns, concurrency, I/O, and low-level unsafe tips, with benchmarks and profiling workflows.
  • Use cases include latency-sensitive services, large-crate builds, binary-size reductions, and optimization of async runtimes like Tokio.
  • Provides measurement-first workflows, safe optimization patterns, and guidance to reproduce improvements across teams.

Quick Start

Profile a Rust project to identify hotspots, then apply the top performance rules to iterate toward measurable improvements.

Frequently Asked Questions about rust-performance-best-practices

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

FAQPage Schema
How do I identify Rust performance bottlenecks in my application?

Apply LTO and PGO build configurations in Rust to optimize performance by reducing binary size and improving runtime speed. Adjusting codegen-units and enabling panic abort across build profiles yields faster, smaller executable outputs.

What's the best way to reduce memory allocations in Rust?

Reduce memory allocations in Rust by applying rule-based allocation strategies and selecting appropriate data structures. Auditing hot code paths for unnecessary allocations achieves better scalability and faster runtimes in latency-sensitive services.

Can I use this to optimize an async Rust runtime like Tokio?

Yes, you can optimize an async Rust runtime like Tokio by applying targeted concurrency and I/O guidance. Measurement-first workflows and safe optimization patterns ensure faster asynchronous execution and better scalability.

When should I use unsafe Rust for performance optimization?

Use unsafe Rust for performance optimization only when safe patterns fall short in hot code paths. The guidance covers low-level unsafe tips to achieve faster runtimes, but emphasizes measurable steps and safe patterns first.