Ferris, the Rust mascotRustacean

Home

❯

mocs

❯

Performance & Optimization

Performance & Optimization

Jun 21, 20261 min read

  • rust
  • performance
  • optimization
  • moc

Performance & Optimization

Rust performance work starts with clear code, then uses profiling and benchmarking to justify targeted changes.

Concepts

  • Profiling Rust Programs
  • Iterator Performance
  • The inline Attribute
  • SIMD and target_feature

Patterns

  • Benchmarking with Criterion
  • Flamegraph and perf Workflow
  • Reducing Heap Allocations
  • Allocator Choices
  • Bounds-Check Elimination
  • Cache-Friendly Data Layout
  • SmallVec for Inline Storage
  • Arena Allocation
  • LTO and codegen-units

Antipatterns

  • Avoiding Premature Optimization
  • Speculative Micro-Optimization

Neighboring Notes

  • Profiles and Optimization Settings
  • Codegen and Optimization Flags
  • Zero-Cost Abstractions
  • Capacity and Reallocation
  • Manual Index Loops for Speed
  • Needless Clone
  • Unnecessary Collect
  • Prefer Iterator Pipelines to Manual Indexing

Sources

  • The Rust Programming Language, ch. 13.4 “Comparing Performance: Loops vs. Iterators” — the-book, https://doc.rust-lang.org/book/ch13-04-performance.html
  • The Rust Programming Language, ch. 14.1 “Customizing Builds with Release Profiles” — the-book, https://doc.rust-lang.org/book/ch14-01-release-profiles.html
  • The Cargo Book, “Profiles” — cargo-book, https://doc.rust-lang.org/cargo/reference/profiles.html
  • The Rust Reference, “Code generation attributes: inline” — the-reference, https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute

Graph View

  • Performance & Optimization
  • Concepts
  • Patterns
  • Antipatterns
  • Neighboring Notes
  • Sources

Backlinks

  • Rust Brain Home
  • Avoiding Premature Optimization
  • Speculative Micro-Optimization
  • Buffered IO with BufReader and BufWriter
  • Iterator Performance
  • Profiling Rust Programs
  • SIMD and target_feature
  • The inline Attribute
  • index
  • Ecosystem & Crate Playbooks
  • Allocator Choices
  • Arena Allocation
  • Benchmarking with Criterion
  • Bounds-Check Elimination
  • Cache-Friendly Data Layout
  • Flamegraph and perf Workflow
  • LTO and codegen-units
  • Reducing Heap Allocations
  • SmallVec for Inline Storage

Created with Quartz v4.5.2 © 2026

  • GitHub
  • Download (.zip)
  • Latest release