Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As always with magic, the magic lies in the eyes who believes it's happening.<br> What are you testing here by the way ? If we forget that, in your doLoopObject, you do not return this.obj, just testing a few times shows that the results are 'random', even worse : if you reverse the order of the tests, they might change depending on Browser. And results will depend on the time you wait in between two clicks. If you wait a few seconds, they will always be almost equal.<br> Now be attentive, on JSPerf, to the speed the numbers are growing, and, especially on Firefox the explanation becomes quite obvious : there are periodic slow-down : the garbage collector is triggered by such garbage creating functions. When it triggers, the figures will increase more slowly, might it be for an object or a local var (it doesn't matter). What you are measuring here is the garbage collector time, NOT the push() time on an object property compared to a local variable. That explains why the order, and the time in between tests, changes things.<br> I will add that the change in between two tests is far too big to conclude anything. </p> <p>But most important is that, when waiting enough, both tests performs the same on FF/Safari... </p> <p>The only conclusion you can draw from all this is : both methods performs the same. </p> <p>BUT Since anyone allocating that much 'heap' would anyway allocate at once, using the simple myArray[lastIndex-1]=0, i'm afraid the real conclusion is : this test shows nothing. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload