2 ms·
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://
by mikepurvis 14y 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/ http://jsfiddle.net/2kWdC/
That way uses an indexed for-loop, but the while loop with Array.push was just as bad.
- iwillreply 14y agoInteresting, 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 https://blogs.oracle.com/greimer/resource/loop-test.html Still seemed to demonstrate a decreasing while loop as the fastest in my test.