top | item 11355015

(no title)

cleverjake | 10 years ago

I work on a major browser. The key thing to keep in mind is that modern javascript engines have an optimized JIT. That means that they are able to optimize code paths for the most common paths on the web. Since its much less likely to see code in the wold that uses the "new Array" pattern, it will most likely be slower than the much (MUCH) more commonly used literal version.

also, microbenchmarks like this are silly, since you probably will never need several million new arrays to be allocated.

discuss

order

muhammadusman|10 years ago

thanks for the information, I wanted to just illustrate the difference between the two. I bet no real world JS would be slow b/c of a few `new Array` calls.