by josephg · 3y ago · 0 comments
Javascript (v8, last I checked) is the opposite. Simple for loops almost always outperform anything else.
Most of the time you should just write whatever's clear/convenient but sometimes it's worth trying both and scrutinizing godbolt.
It’s also much easier to stick to for() loops in javascript as you code than it is to rewrite everything later when tuning for performance. If that’s something you expect to need to do.