Skip to content
Rust Search
← RustWeek 2026

When Iterators Aren't Zero Cost

RustNL
RustWeek 21:38 5264 views

When Iterators Aren't Zero Cost by Xavier Denis. Here’s something that surprises many new Rust developers: iterators can be *faster* than hand-written loops. The compiler sees the pattern, LLVM works its magic, and the result outperforms manual code. Now here’s something that surprises even experienced Rust developers: in certain cases, iterators make code 3-4x slower. We’re taught to believe that iterators are zero cost. But what happens when they aren't? On modern CPUs, performance comes from

Player unavailable or embedding blocked? Use the YouTube link above.