Hacker News new | ask | show | jobs
by mikepurvis 4836 days ago
Interesting. On a whim, I tried changing your fiddle to use Array.join construction rather than string appends, but string appends remain 5-10% faster:

http://jsfiddle.net/2kWdC/

That way uses an indexed for-loop, but the while loop with Array.push was just as bad.

1 comments

Interesting, I very briefly deliberated while vs for, and how the performance of both had changed since last look.

But checking at: https://blogs.oracle.com/greimer/resource/loop-test.html

Still seemed to demonstrate a decreasing while loop as the fastest in my test.