Push vs Length

Benchmark created by Fedor Indutny on


Preparation HTML

<script>
 function push1(a, b) {
  a[a.length] = b;
 }
 
 function push2(a, b) {
  a.push(b);
 }
 
 var a1 = [];
 var a2 = [];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Push1
push1(a1, 1);
ready
Push2
push2(a2, 1);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Fedor Indutny on