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

Gregg Tavares (wrk) [email protected]
Mon Feb 14 09:15:52 PST 2011

So I probably shouldn't respond to this because being on the Chrome team no
matter what I say it will sound defensive but:

*) Are you sure these are valid tests? Rumor is some JavaScript engines will
see that the results you are calculating are never used and optimize the
entire test away. I don't know if Minefield goes that far though if it did
that would be pretty cool

*) Are you sure they are computing the same things? For example mjs doesn't
appear to have a true matrix inverse so you're comparing apples to oranges
vs the other  libraries there.

*) I added the math library from the tdl stuff. They are slightly faster at
some things and slower at others. Attached (sorry, new to git)

*) Matrix math isn't everything. For example running the webgl aquarium on
FF4b11 vs Chromium 11.0.668.0 (74525) on your hardware (I have the same
machine) using this url

At 50 fish

FF: 40fps
Chromium: 60fps

At 1000 fish

FF: 25fps
Chromium: 60fps

I bring that up because it's hard to compare matrix math libraries as they
don't all do the same thing. For example, many of the matrix math libraries
create objects like a Matrix4 object. Others don't and just use JavaScript
arrays or Float32Array completely un-augmented. Which is better? No idea. If
it turns out objects are slower but more convenient which would you pick?
 Another example, some libraries work better if you give them a destination
variable. I think mjs this is true and I know the tdl fast library (which
sadly is not so fast) also requires that. But your benchmark doesn't take
those differences into account. Another is that you're almost always doing
your math in place meaning you pass in a matrix and expect that matrix to be
translated, rotated or scaled in place rather than returning a new matrix
and leaving the original alone. That difference is not taken into account.

Of course none of that explains why FF is 5 times faster for your test as it

On Sun, Feb 13, 2011 at 8:55 PM, Stephen Bannasch <
[email protected]> wrote:

>  Are JavaScript matrix libraries suitable for WebGL programming really 5x
> faster in Minefield than Chrome ... and about twice asfast in Chrome than
> in a WebKit nightly?
> This is what I found with an adaptation of with Brandon Jones's benchmarks
> in his glmatrix library: https://glmatrix.googlecode.com/hg/
> See the data below ...
> I was working with the JavaScript graphing library flotr and wanting to
> pick a matrix library for some webgl work so I adapted the benchmarks
> Brandon Jones created in his glmatrix library:
> https://glmatrix.googlecode.com/hg/.
> My changes include:
> - I'm only including the benchmarks.
> - I've updated to the latest mjs as of Dec 15: 16:8e5b0944ef1e and included
> it in several more tests.
> - I've also added a graph display of the results using flotr, see:
> http://solutoire.com/flotr/
> My fork of these benchmarks are available here:
> https://github.com/stepheneb/webgl-matrix-benchmarks
> And you can run them in a browser with webgl at this url:
> http://stepheneb.github.com/webgl-matrix-benchmarks/matrix_benchmark.html
> [The somewhat lame reason this is a fork is that it was taking me longer
> thanI wanted using mercurial (don't use hg much) to follow the typical
> workflow I use on github, fork a repo, push my changes into a branch and
> send a pull request to the original developer ...]
> The following data were generated on a MacBook Pro running MacOS X 10.6.6
> with a 2.66 GHz Intel Core i7 and a NVIDIA GeForce GT330M 512MB
> Google Chrome 9.0.597.102
> WebKit nightly 78038
> Minefield 4.0b12pre (2011-02-13)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110214/c363482e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: P7C64A102.png
Type: image/png
Size: 67308 bytes
Desc: not available
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110214/c363482e/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: P7C64A102 2.png
Type: image/png
Size: 54971 bytes
Desc: not available
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110214/c363482e/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: P7C64A102 1.png
Type: image/png
Size: 75569 bytes
Desc: not available
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110214/c363482e/attachment-0002.png>
-------------- next part --------------
This is a message from the MailScanner E-Mail Virus Protection Service
The original e-mail attachment "webgl-matrix-benchmarks.zip"
is on the list of unacceptable attachments for this site and has been
replaced by this warning message.

If you wish to receive a copy of the original attachment, please
e-mail helpdesk and include the whole of this message
in your request. Alternatively, you can call them, with
the contents of this message to hand when you call.

At Mon Feb 14 11:16:40 2011 the virus scanner said:
   MailScanner: JScript Scripts are dangerous in email (base64.js)

Note to Help Desk: Look on the Khronos (secure2.khronos.org) MailScanner in /home/virtual/site42/fst/var/spool/mail.quarantine/20110214 (message p1EHG3Mg029066).
Khronos Group

For all your IT requirements visit: http://www.transtec.co.uk

More information about the public_webgl mailing list