Adding methods to array and performance

Benchmark created by Apples on


Setup

var arr1 = [];
    
    var arr2 = [];
    arr2.foo = function() {};
    arr2.bar = function() {};

Test runner

Ready to run.

Testing in
TestOps/sec
native array
var i = 1000000;

while (i > 0) {
  i--;
  arr1.push(Math.random());

}
ready
arr w/ methods
var i = 1000000;

while (i > 0) {
  i--;
  arr2.push(Math.random());

}
ready

Revisions

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

  • Revision 1: published by Apples on