PDA

View Full Version : Slow resizing on FF, getComputedStyle() slow



mgrouch2
16 Dec 2010, 8:12 AM
Hello,

We experience very slow resizing of windows with tables with FF.
Doing profile and comparing with profile of grid window example (http://www.sencha.com/examples/desktop.html)
we see that getComputedStyle() is taking most of the time.
We see approximately same amount of calls to getComputedStyle() in our application profile and in GXT example.
However for some reason getComputedStyle() is much slower (~6 times) in our application.
(with max call time of ~250ms). There are bout 60 calls to that function.

What could be the reason?

Thanks,
--MG

sven
16 Dec 2010, 8:15 AM
getComputedStyle is very slow in FF, this is true. However getComputedStyles could get multiply styles at once. Depending of what your application is getting there, it can be slower or faster.

There are plans forGXT 3 for a complete new layoutsystem which will be faster.

mgrouch2
16 Dec 2010, 8:20 AM
It seems our application is getting via getComputedStyle() mostly paddings and border sizes (which are constants).
The window layout in our app is very close to Grid Window (http://www.sencha.com/examples/desktop.html).
One grid fitted into window. Yet it is much slower. What could we be doing wrong?

Thanks,
--MG

sven
16 Dec 2010, 8:27 AM
How many rows do you display in your grid? Also how big is your overall dom?

mgrouch2
16 Dec 2010, 8:37 AM
we show 20 to 50 rows. our dom is about 3000 nodes

sven
16 Dec 2010, 8:38 AM
Hard to say way its much slower if things are almost the same. Have you tried to reproduce this in a small, standalone testcase?

mgrouch2
16 Dec 2010, 12:23 PM
I think we found the issue.
Window calls Resizable and in handleMouseDown()
spends most time in proxyEl.setSize(startBox.width, startBox.height, true);

which calls El.java

Size frameWidth = getFrameSize();

because adjust parameter is set to true.

getFrameSize() calls FastMap<String> map = getStyleAttribute(list);
to calculate padding and border sizes.

We would like to avoid this call as we know our frame parameters and we do not need
to recalculate them for each resize().

Now the question is how we can override this behavior. There are a lot of private
variables that make overriding difficult and require a lot of code cloning.

Is it possible to open up this part of API so the users of GXT library could optimize it for their performance needs?

Thanks,
--MG

sven
16 Dec 2010, 12:24 PM
Is it possible to open up this part of API so the users of GXT library could optimize it for their performance needs?
Tell me your exact requirements an i will look into what can be done.

mgrouch2
16 Dec 2010, 1:07 PM
Window.resizer make protected
Resizable.proxyEl make protected
refactor line in Resizable.handleMouseDown
proxyEl.setSize(startBox.width, startBox.height, true); into separate protected method with these arguments (int width, int height, boolean adjust).

Thanks,
--MG