20 September 2011

it'funq.16

Snappier Loops
So, which of the four loops is fastest?
No, not for.
Not while either.
Definitely not for in. That one runs like a tortoise.
So then, it has to be do while, right? Sorry, no.
Alright, so that was a trick question. for in loops are the slowest. Sometimes they’re seven times slower than the others.

Terry McNavage
JavaScript for Absolute Beginners
Apress(2010)