
Originally Posted by
retep998
You were expressing uncertainty regarding the performance of fancy iterator stuff, like filter and foreach, compared to handwritten loops. Since that difference alone is not an algorithmic difference, and I know from personal experience that iterators can be implemented very efficiently (see Rust), I therefore classified it under premature optimization. Now if you did benchmark the various techniques and get some numbers to demonstrate that iterators are significantly slower than the equivalent handwritten loop, then that optimization would no longer be premature.