Object Overhead (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script>
  function Vdirect(x,y,z) {
  this.x = x;
  this.y = y;
  this.z = z;
  }
  
  Vdirect.prototype.cross = function (w) {
  return new Vdirect(
  this.y*w.z-this.z*w.y,
  this.z*w.x-this.x*w.z,
  this.x*w.y-this.y*w.x
  );
  };
  
  function Varray(u) {
  this.e = u;
  }
  
  Varray.prototype.cross = function (w) {
  return new Varray([
  this.e[1]*w.e[2]-this.e[2]*w.e[1],
  this.e[2]*w.e[0]-this.e[0]*w.e[2],
  this.e[0]*w.e[1]-this.e[1]*w.e[0]
  ]);
  };
  
  var Adirect = new Vdirect(1,2,3);
  var Bdirect = new Vdirect(4,5,6);
  var Aarray = new Varray([1,2,3]);
  var Barray = new Varray([4,5,6]);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
direct properties
var Cdirect = Adirect.cross(Bdirect);
ready
array properties
var Carray = Aarray.cross(Barray);
ready

Revisions

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