Array vs object tuple (v3)

Revision 3 of this benchmark created on


Setup

x = 1;
  y = 2;
  z = 3;
  a = 42;
  b = 1337;
  c = 0;
  d = 9;
  e = 7;
  f = 55;
  testClass = function(x,y){
  
    this.x = x;
    this.y = y;
  };
  testClassLarge = function(x,y,z,a,b,c,d,e,f){
  
    this.x = x;
    this.y = y;
    this.z = z;
    this.a = a;
    this.b = b;
    this.c = c;
    this.d = d;
    this.e = e;
    this.f = f;
  };

Test runner

Ready to run.

Testing in
TestOps/sec
Array
var arr = [x, y, z];
ready
Object
var obj = {x: x, y: y, z: z};
ready
Large array
var arrLarge = [x, y, z, a, b, c, d, e, f];
ready
Large object
var objLarge = {x: x, y: y, z: z, a: a, b: b, c: c, d: d, e: e, f: f};
ready
New Array
var arrNew = new Array(3);
arrNew[0] = x;
arrNew[1] = y;
arrNew[2] = z;
ready
New Array Large
var arrNewLarge = new Array(9);
arrNewLarge[0] = x;
arrNewLarge[1] = y;
arrNewLarge[2] = z;
arrNewLarge[3] = a;
arrNewLarge[4] = b;
arrNewLarge[5] = c;
arrNewLarge[6] = d;
arrNewLarge[7] = e;
arrNewLarge[8] = f;
ready
New Class
var arrClass = new testClass(x, y, z);
ready
New Class Large
var arrClassLarge = new testClassLarge(x, y, z, a, b, c, d, e, f);
ready

Revisions

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