Lesson 44 of 50
rustPerformance Optimization
15 minutes
Course progress88%
Performance Optimization
Rust already produces fast code. For further tuning:
- Use
cargo benchfor benchmarks. - Profile with
perforvalgrind. - Inline critical sections with
#[inline(always)]. - Prefer stack allocation over heap when possible.
- Avoid unnecessary clones; use references.
#[inline(always)]
fn (v: &[]) {
v.().()
}