X2 Matrix vs GL Matrix2 Rotations

JavaScript performance comparison

Revision 13 of this test case created by mattdesl

Preparation code

<script src='http://sandbox.goxtk.com/x2/x2.js'>
</script>
<script src='http://sandbox.goxtk.com/x2/gl-matrix-min.js'>
</script>
<script src='https://raw.github.com/mrdoob/three.js/master/build/three.min.js'></script>
<script>
Benchmark.prototype.setup = function() {
    var m1 = X.Matrix.identity();
    var v1 = new X.Vector(1, 2, 3);
   
   
    var m1gl = mat4.create();
    var v1gl = vec3.fromValues(1, 2, 3);
   
    var m1tj = new THREE.Matrix4();
    var v1tj = new THREE.Vector3(1, 2, 3);
};
</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
X2 Matrix
v1.x = 1;
v1.y = 2;
v1.z = 3;
v1.normalize();
X.Matrix.rotate(m1, Math.PI / 2, v1.x, v1.y, v1.z);
pending…
GL Matrix2
v1gl[0] = 1;
v1gl[1] = 2;
v1gl[2] = 3;
vec3.normalize(v1gl, v1gl);
mat4.rotate(m1gl, m1gl, Math.PI / 2, v1gl);
pending…
three.js
v1tj.x = 1;
v1tj.y = 2;
v1tj.z = 3;
v1tj.normalize();
m1tj.rotateByAxis(v1tj, Math.PI/2);
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