PDA

View Full Version : Component class change performance



AdmSrck
26 Oct 2011, 12:48 AM
Hey,

I noticed that execution of addCls and removeCls on component is much slower on Sencha Touch 2.0 than 1.1. Everything would be ok, but on iPad 1st gen (and everything slower) it's affecting user experience (yes - there is a case where it's possible ;) ).
It seems that you bind some 'events' on class change. So I'm wondering if this part of code is final and what was the reason of this change.

Regards,
Adam

edspencer
29 Oct 2011, 6:55 PM
Thanks Adam, will look into this. Performance is very important to us

Jacky Nguyen
2 Nov 2011, 10:32 AM
Hey,

I noticed that execution of addCls and removeCls on component is much slower on Sencha Touch 2.0 than 1.1. Everything would be ok, but on iPad 1st gen (and everything slower) it's affecting user experience (yes - there is a case where it's possible ;) ).
It seems that you bind some 'events' on class change. So I'm wondering if this part of code is final and what was the reason of this change.

Regards,
Adam

I believe you're referring to performance of reflow / redraw as a consequence of toggling a class on an element, as opposed to performance of addCls / removeCls methods themselves. If that's the case we are aware of that (typically on iOS), possibly due to the major change in layout which relies entirely on pure CSS. This should be addressed in our next release.

AdmSrck
3 Nov 2011, 4:13 AM
Thank you guys for your answers.

In fact my problem was connected to unnecessary reflow, but I was distracted by small test I performed: I looped addCls and removeCls on the same component on Sencha Touch 1.1 and then 2.0 and used profiler to find out what was an execution time. It turns out that ST2.0 is slower, but is not an issue which can affect user experience (effect of slower add/removeCls is relatively small to repaint/reflow). So I was wrong. Refactoring my code helped, and it's very hard to find any difference from user point of view.

Thank you for your time, and sorry for false alarm.
Regards,
Adam

edspencer
3 Nov 2011, 11:21 AM
No problem, thanks for following up :)