DEV Community

Discussion on: Assigning [ ] performs better than Array(n) - Reports attached.

 
miketalbot profile image
Mike Talbot ⭐

Reversing the order of the tests reveals the opposite answer - I fear this is a jsPerf limitation. But again you have now made a weird array by adding values and not pushing for packed - so perhaps it's also a browser implementation of that which is giving you amazingly dramatically different results. Without the actual perf I can't see but 94% slower seems just very odd and certainly not inline with the one I link below in either case.

Screenshot

jsperf.com/testh-v-p

Thread Thread
 
svaani profile image
Vani Shivanand • Edited

I already mentioned about chrome vs firefox. Please go through the entire thread before commenting.

Also, don't forget to watch the video that is posted at the end of article. It is by v8 team member. That should answer most of your questions if you won't trust on random tests.

I won't be able to respond on this post further if the video provided at the end of post is not watched. Thanks!