4 ms·
> It's hard to beat the C-style for-loop: they map really closely to the underlying hardware, and modern compilers are starting to become really good at auto-ve
by qayxc 5y ago
> It's hard to beat the C-style for-loop: they map really closely to the underlying hardware, and modern compilers are starting to become really good at auto-vectorizing them.
Except with many compilers and depending on the loop, for-loops may optimise much poorer than their C++/Rust iterator based counterparts.
That's because modern language constructs can communicate intent much clearer to the compiler than a primitive for-loop can; the compiler has to make fewer assumptions (which can can be wrong).
So no, it's not "generally true" at all.
- deleted 5y ago[deleted]