[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] WebKitCSSMatrix and WebGL

On 12/12/2010, at 5:15 AM, Vladimir Vukicevic wrote:
> Is there a benchmark somewhere that compares the performance of doing the math in JS vs. doing it using WebKitCSSMatrix?

Yes, from Chris' earlier message:

> 	https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/demos/webkit/MatrixTest.html
> In doing some informal benchmarking, I'm not seeing significant speedup. I believe this is mainly due to the fact that CSSMatrix is immutable (i.e., it returns a new CSSMatrix from every call). This causes a lot of GC churn which affects performance. We made it immutable to match SVGMatrix, but in retrospect, that might have been a mistake. I'm looking now at possibly trying to change the CSSMatrix spec to mutate the passed matrix in place, or at least add methods that do mutation.
> Interestingly, J3DIMatrix can also use a "copy" function. This is a method I experimentally added to CSSMatrix. You pass a Float32Array with space for at least 16 floats and the current matrix will be copied into it. This yielded an improvement of 30-40% over both the version that did matrix math in JS and the CSSMatrix version which picked values out of the matrix by hand. This tells me that CSSMatrix probably IS faster, but the GC overhead is eating all that extra performance. It also tells me that with a few small changes and additions, we can significantly improve matrix math in WebGL.

My further request is based on the fact that any mathematical operation, even as simple as "add", has the same problem of needing to "pick" every variable in the matrix. So if this stuff gets shovelled into CSSMatrix, it kills off three birds with one stone... useful functionality for CSS, SVG and WebGL... native performance for the common case... and makes WebGL that bit easier.


You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: