[Public WebGL] JavaScript matrix libraries really 5x faster in Minefield than Chrome?

Stephen Bannasch [email protected]
Mon Feb 14 11:00:10 PST 2011

At 10:39 AM -0800 2/14/11, Gregg Tavares (wrk) wrote:
>So I went looking as to why certain functions where faster in other libraries than the one I use. Not that I expect the one I use to be the fastest but I'm happy to optimize it. But, here's another example of apples vs oranges.
>The CanvasMatrix library transposes matrices in place. That means it only has to swap 6 pairs of values.
>The TDL math library always creates a new matrix
>So, the question is which is faster? Well, that depends on usage. If I need both the transpose and the untransposed matrices then in CanvasMatrix library I'll also need to  copy the matrix. In other words in pseudo code..
>   tdl:
>   transposedMatrix = transpose(originalMatrix);
>   CanvasMatrix:
>   transposedMatrix = new CanvasMatrix(originalMatrix);
>   transposedMatrix.transpose();
>How do you compare those 2 libraries? They meet different usage styles?

I noticed something similar when I added mjs into a few more benchmarks when I integrated a newer version than Brandon had in glmatrix ...

I noticed a large speedup if mjs didn't have to create the result matrix but instead was supplied an existing matrix to write the result into.

Of course as the person making these changes in the benchmark it was both interesting and useful to understand the effect of these changes.

However these differences are not clear to somebody just viewing this page:


Some uses might require anew matrix to be created others could be written to supply an existing place to put the result.

I think it would be interesting to setup the benchmarks to both indicate and report the results for running both ways (if the library supports this):

- writing result in place
- results written to an separate existing object
- result returned in a new object.
You are currently subscribed to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:
unsubscribe public_webgl

More information about the public_webgl mailing list