4 ms·
See also this benchmark, which seems to have very different results from the scottlogic link: http://jsperf.com/array-push-vs-array-length23333/2 http://jsperf.
by marijn 13y ago
See also this benchmark, which seems to have very different results from the scottlogic link: http://jsperf.com/array-push-vs-array-length23333/2 http://jsperf.com/array-push-vs-array-length23333/2
I just re-ran it on FF24 (nightly), and also saw results where .push beats this kludge.
So before everyone runs off and takes 'direct array assignment is fast' as a rule of thumb, please consider that it quite probably isn't.
- hayksaakian 13y agoAlso faster in most versions of chrome