# Comparison Matrix and Vector library

## JavaScript performance comparison

Revision 6 of this test case created

## 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>  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><script>  Benchmark.prototype.setup = function() {    var n3dm = new \$M4(    1, 2, 3, 4, 0, 5, 6, 7, 0, 0, 8, 9, 0, 0, 0, 10);    var n3dv = new \$V4( 1, 2, 3, 4 );    var threem = new THREE.Matrix4(    1, 2, 3, 4, 0, 5, 6, 7, 0, 0, 8, 9, 0, 0, 0, 10);    var threev = new THREE.Vector4(1, 2, 3, 1);    var nv = [1, 2, 3, 1];    var nm = [      [1, 2, 3, 4],      [0, 5, 6, 7],      [0, 0, 8, 9],      [0, 0, 0, 10]    ];    var tsv = new TSM.vec4([1,2,3,1]);    var tsm = new TSM.mat4([      1, 2, 3, 4,       0, 5, 6, 7,       0, 0, 8, 9,       0, 0, 0, 10    ]);    var glv = quat4.create([1,2,3,1]);    var glm = mat4.create([      1, 2, 3, 4,       0, 5, 6, 7,       0, 0, 8, 9,       0, 0, 0, 10       ]);      };</script>``

## 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
``n3dm.inverse();n3dm.multiply(n3dm);n3dv.add(n3dv);n3dm.multiplyVector4(n3dv);``
pending…
Three.js
``threem.getInverse(threem);threem.multiply(threem, threem);threev.add(threev);threem.multiplyVector4(threev);``
pending…
numericjs
``nm = numeric.inv(nm);nm = numeric.mul(nm, nm);nv = numeric.add(nv);nm = numeric.mul(nv);``
pending…
TSM
``tsm.inverse();tsm.multiply(tsm);tsv.add(tsv);tsm.multiplyVec4(tsv);``
pending…
glMatrix
``mat4.inverse(glm);mat4.multiply(glm,glm);quat4.add(glv,glv);mat4.multiplyVec4(glm,glv);``
pending…

## 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: