Re:Falling in love with Rust
by gamegoblin on Wednesday September 19, 2018 @05:06PM
(#18027712)
No, the iterators are "lazy" (pull-based). Both implementations will perform the same amount of work.
Oftentimes the iterator will be faster, though, because the compiler can reason about what you're doing easier with an iterator vs. iterating via manual sequential indexing.
Oftentimes the iterator will be faster, though, because the compiler can reason about what you're doing easier with an iterator vs. iterating via manual sequential indexing.