I don't understand why this test :
http://jsperf.com/push-method-vs-setting-via-key
Shows that
a.push(Math.random());
is over ten times slower than
a[i] = Math.random();
Could you explain why this is the case ? What magic "push" do that make it so slow ? (or so slow compared to other valid method of doing that).
EDIT
NOTE: The push test is biased. I increase size of the array every iteration! Read carefully accepted answer!