Simple benchmarks for testing the speed of JavaScript matrix libraries adapted from Brandon Jones benchmarks in his glmatrix library: https://glmatrix.googlecode.com/hg/
You can run the benchmarks here.
You can select specific benchmarks by adding ?tests=name,name,name
for example
test glMatrix (float32) vs glMatrix-native vs glMatrix-float64
test twgl (float32) vs twgl-native vs twgl-float64
test all glMatrix and twgl tests
https://greggman.github.io/webgl-matrix-benchmarks/matrix_benchmark.html?tests=twgl,glMatrix
You can also limit test benchmarks with ?benchmark=name,name,name
for example
test only matrix multiplication
https://greggman.github.io/webgl-matrix-benchmarks/matrix_benchmark.html?benchmarks=mult
Note: an observation ... whether or not a particular JavaScript engine optimizes something seems to be context dependent. I've seen one library outperform another even when the code is EXACTLY the same. In trying to track down why one was faster than another I copy the code (say matrix multiply) from one library to the other and yet still found a difference in execution larger than noise. In general though execution is consistent across runs
This work is based on Brandon's work as of this commit:
e5ad8f6975eef038de668914a44ed36e2c611966
Date: October 10, 2010 12:49:00 PM EDT
Upped version to 0.9.5
Comparing these matrix libraries:
- glMatrix, zlib license
- mjs, MIT license
- CanvasMatrix
- EWGL_math, New BSD license
- tdl, New BSD license
- Three.js, New BSD license
- twgl, New BSD license
- Closure, Apache 2.0
- Sylvester, MIT license
Changes from Brandon's original benchmark code include:
- Only including the benchmark code from glmatrix.
- Updated to the latest mjs as of Dec 15: 16:8e5b0944ef1e and included it in several more tests.
- Added a graph display of the results using flotr, see: http://solutoire.com/flotr/
- Added tdl library (thanks to Gregg Tavares)
- each library runs in an iframe so the code won't affect the other libraries (thanks to Gregg Tavares)
- Added Sylvester library (thanks to Felix E. Klee)
Brandon's original code was released under the New BSD license. My additions to the benchmarking code are released under the same license.