typed Array vs JS Array vs Object (v6)

Revision 6 of this benchmark created by Jason Oster on


Description

Testing computational speed for using Typed Array, JSON Array Object and JS Object

Setup

var typed = new Int32Array([211, 432, 421]);
    
    var array = [211, 432, 421];
    
    var obj = {
      xxz: 211,
      yxz: 432,
      zxz: 421
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Typed Array
for (var i = 0; i < 100; i++) {
  typed[0] *= i;
  typed[1] *= i;
  typed[2] *= i;
}
ready
JS Array
for (var i = 0; i < 100; i++) {
  array[0] *= i;
  array[1] *= i;
  array[2] *= i;
}
ready
JS Object
for (var i = 0; i < 100; i++) {
  obj.xxz *= i;
  obj.yxz *= i;
  obj.zxz *= i;
}
ready

Revisions

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

  • Revision 1: published by Corey Clark on
  • Revision 2: published on
  • Revision 3: published by Nexii Malthus on
  • Revision 4: published by bluefireuoop on
  • Revision 5: published by bluefireuoop on
  • Revision 6: published by Jason Oster on