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

Re: [Public WebGL] Matrix objects in JavaScript

On Thu, Mar 21, 2013 at 10:16 PM, Rik Cabanier <cabanier@gmail.com> wrote:
Which one is faster:
element.style.transform = window.getComputedStyle(element).transformMatrix.rotateBy(45); // 1 temporary object. all calculations on c++ side
... make sure some js library is loaded
element.style.transform = new MyMatrix(window.getComputedStyle(element).transform).rotateBy(45).getFloatArray(); // 2 (or 3) temporary objects + 6 or 16 (12 or 32?) temporary floats + all calculations on js side

Neither, this one is faster:

mat4Rotate(window.getComputedStyle(element).transform, 45, element.style.transform)
                                                              ^ source    ^a                        ^ target

We're quite serious when we say temporaries/allocation is a serious problem, seriously, we're not joking. And lengthy discussions on the GC issue have been conducted with only one clear outcome, while things may get better, they will not get perfect.