Optimizing What Matters
Apply fixes where they count.
Fix Only the Hot Path
Spend effort where the profiler points. Optimizing cold code wastes time and adds complexity for a speedup nobody will ever feel.
Reach for fn and Types
A strict fn with typed arguments lets Mojo compile tight, fast code. Swapping a hot def for fn is often the easiest big win.
fn dot(a: Float64, b: Float64) -> Float64:
return a * bAll lessons in this course
- Timing and Benchmarking Tools
- Finding the Real Bottleneck
- Optimizing What Matters
- Reading a Profile Report