Matrix library performance for 3x3

Benchmark created by Nik on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/vectorious/4.8.1/vectorious.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/3.11.5/math.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gl-matrix/2.3.2/gl-matrix.js"></script>

Setup

function randomArray(length) {
      return Array.apply(null, Array(length)).map(function() {
          return Math.round(Math.random());
      });
  }
  
  var vectoriousA = Matrix.zeros(3, 3).map(Math.random);
  var vectoriousB = Matrix.zeros(3, 3).map(Math.random);
  var mathjsA = math.map(math.zeros(3, 3), Math.random);
  var mathjsB = math.map(math.zeros(3, 3), Math.random);
  var glMatrixA = mat3.fromValues.apply(randomArray(9));
  var glMatrixB = mat3.fromValues.apply(randomArray(9));
  var glMatrixOut = mat3.create();

Test runner

Ready to run.

Testing in
TestOps/sec
vectorious 4.8.1
vectoriousA.add(vectoriousB);
vectoriousA.subtract(vectoriousB);
vectoriousA.multiply(vectoriousB);
ready
math.js 3.11.5
math.add(mathjsA, mathjsB);
math.subtract(mathjsA, mathjsB);
math.multiply(mathjsA, mathjsB);
ready
glMatrix 2.3.2
mat3.add(glMatrixOut, glMatrixA, glMatrixB);
mat3.subtract(glMatrixOut, glMatrixA, glMatrixB);
mat3.multiply(glMatrixOut, glMatrixA, glMatrixB);
ready
glMatrix 2.3.2 Create
var glMatrixOut = mat3.create();
mat3.add(glMatrixOut, glMatrixA, glMatrixB);
mat3.subtract(glMatrixOut, glMatrixA, glMatrixB);
mat3.multiply(glMatrixOut, glMatrixA, glMatrixB);
ready

Revisions

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