Comparison Matrix and Vector library

JavaScript performance comparison

Revision 5 of this test case created by 1Pupik1989

Preparation code

<script src="https://glmatrix.googlecode.com/files/glMatrix-0.9.5.min.js"></script>
<script src="https://raw.github.com/mrdoob/three.js/master/build/three.js">
</script>
<script src="https://raw.github.com/1Pupik1989/N3D/master/source/N3D.min.js">
</script>
<script type="text/javascript">
  N3D.require("Math.Matrix4", "Math.Vector4");

  quat4.add = function(quat,quat2,dest){
    if(!dest) { dest = quat; }
   
    dest[0] = quat[0] + quat2[0];
    dest[1] = quat[1] + quat2[1];
    dest[2] = quat[2] + quat2[2];
    dest[3] = quat[3] + quat2[3];
   
    return dest;
  };
</script>
<script src="https://raw.github.com/sloisel/numeric/master/src/numeric.js">
</script>
<script src="https://raw.github.com/vexator/TSM/master/TSM/tsm-0.6.min.js"></script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
N3D
var v = new $V4(1, 2, 3, 1);
var m = new $M4(
1, 2, 3, 4, 0, 5, 6, 7, 0, 0, 8, 9, 0, 0, 0, 10);

m.inverse();
m.multiply(m);
v.add(v);
m.multiplyVector4(v);
pending…
Three.js
var v = new THREE.Vector4(1, 2, 3, 1);
var m = new THREE.Matrix4(
1, 2, 3, 4, 0, 5, 6, 7, 0, 0, 8, 9, 0, 0, 0, 10);

m.getInverse(m);
m.multiply(m, m);
v.add(v);
m.multiplyVector4(v);
pending…
numericjs
var v = [1, 2, 3, 1];
var m = [
  [1, 2, 3, 4],
  [0, 5, 6, 7],
  [0, 0, 8, 9],
  [0, 0, 0, 10]
];
m = numeric.inv(m);
m = numeric.mul(m, m);
v = numeric.add(v);
m = numeric.mul(v);
pending…
TSM
var v = new TSM.vec4([1,2,3,1]);
var m = new TSM.mat4([
  1, 2, 3, 4,
  0, 5, 6, 7,
  0, 0, 8, 9,
  0, 0, 0, 10
]);

m.inverse();
m.multiply(m);
v.add(v);
m.multiplyVec4(v);
pending…
glMatrix
var v = quat4.create([1,2,3,1]);
var m = mat4.create([
  1, 2, 3, 4,
  0, 5, 6, 7,
  0, 0, 8, 9,
  0, 0, 0, 10  
]);
mat4.inverse(m);
mat4.multiply(m,m);
quat4.add(v,v);
mat4.multiplyVec4(m,v);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment