
M10 Performance
This is your checklist before you start micro-optimizing Rust code. It walks you through the measurement-first approach: profile with flamegraphs, benchmark with criterion, then prioritize fixes by impact (algorithm choice gets you 10-1000x, allocations maybe 2-5x). The tables map bottlenecks to specific techniques like Vec::with_capacity for pre-allocation or rayon for parallelism. What I like is the explicit trace up to domain constraints and down to implementation skills, so you're not optimizing in a vacuum. It's opinionated about common mistakes (LinkedList is cache-hostile, always benchmark in release mode) and assumes you've already made it work correctly. Good reference when someone says "make it faster" and you need to figure out what that actually means.
- skills.sh installs
- 3.8K
- GitHub stars
- 1.6K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add actionbook/rust-skills --skill m10-performance --agent claude-codeInstalls into .claude/skills of the current project.
Files
Performance Optimization
Layer 2: Design Choices
Core Question
What's the bottleneck, and is optimization worth it?
Before optimizing:
- Have you measured? (Don't guess)
- What's the acceptable performance?
- Will optimization add complexity?
Performance Decision → Implementation
| Goal | Design Choice | Implementation |
|---|---|---|
| Reduce allocations | Pre-allocate, reuse | with_capacity, object pools |
| Improve cache | Contiguous data | Vec, SmallVec |
| Parallelize | Data parallelism | rayon, threads |
| Avoid copies | Zero-copy | References, Cow<T> |
| Reduce indirection | Inline data | smallvec, arrays |
Thinking Prompt
Before optimizing:
-
Have you measured?
- Profile first → flamegraph, perf
- Benchmark → criterion, cargo bench
- Identify actual hotspots
-
What's the priority?
- Algorithm (10x-1000x improvement)
- Data structure (2x-10x)
- Allocation (2x-5x)
- Cache (1.5x-3x)
-
What's the trade-off?
- Complexity vs speed
- Memory vs CPU
- Latency vs throughput
Trace Up ↑
To domain constraints (Layer 3):
Sponsors
Details
- Repository
- github.com/actionbook/rust-skills
- Categories
- Debugging, Rust
- First seen
- May 16, 2026
More from actionbook/rust-skills
All 38- M07 Concurrency3.7K
- M06 Error Handling3.7K
- M01 Ownership3.6K
- M04 Zero Cost3.6K
- M05 Type Driven3.6K
- M02 Resource3.6K
- M03 Mutability3.6K
- Rust Refactor Helper3.6K
- M12 Lifecycle3.5K
- M09 Domain3.5K
- M14 Mental Model3.5K
- M11 Ecosystem3.5K
- M13 Domain Error3.5K
- Unsafe Checker3.5K
- Rust Code Navigator3.4K
- Rust Trait Explorer3.4K
- Rust Call Graph3.4K
- Rust Symbol Analyzer3.4K
- Domain Web3.4K
- Domain Cli3.4K
- Rust Learner3.3K
- Rust Skill Creator3.3K
- Rust Deps Visualizer3.2K
- Meta Cognition Parallel3.2K