I'm a little confused by this change since you removed the use of applyCSS from 
a lot of places, but not uniformly.  For instance, some places you took set 
`width` directly, others you use applyCSS.  Maybe the real problem is that the 
overhead of a function call is greater than the overhead of setting an 
identical value into a div's style?

I would hope that browsers would be smart enough to do nothing if you set a 
style value to the value it already has, so the only overhead really can be 
that the style properties have setter methods, but those must cost the same as 
a function call, no?

But, if you see a performance increase:  Approved.

On 2010-04-20, at 12:29, Max Carlson wrote:

> Change 20100420-maxcarlson-4 by maxcarl...@friendly on 2010-04-20 09:22:40 PDT
>    in /Users/maxcarlson/openlaszlo/trunk-clean
>    for http://svn.openlaszlo.org/openlaszlo/trunk
> 
> Summary: Optimize text size measurement
> 
> Bugs Fixed: LPP-6892 - Generated File Sizes baseline complete; Performance 
> Tuning ongoing (partial)
> 
> Technical Reviewer: ptw
> QA Reviewer: hminsky
> 
> Details: LzSprite - Uncommenting the cache statistics code (csshit/miss) 
> showed a lot of CSS values that were only updated once.  Only use applyCSS() 
> where cache hits were shown.
> 
> LzTextSprite - Only use applyCSS() where cache hits were shown.  Use cached 
> CSS values to assemble text measurement CSS string.
> 
> LzInputTextSprite - Only use applyCSS() where cache hits were shown.  Ensure 
> cached value for _whiteSpace is properly updated.  
> 
> LzText - Prevent unneeded updates to setMaxLength().
> 
> Tests: test/lztest/lztest-textheight.lzx runs as before in DHTML, as does 
> amazon, lzpix, component sampler.  Firebug shows a fairly substantial 
> improvement to startup time - text measurement is now fairly even with 
> everything else as far as CPU time goes...
> 
> Files:
> M       WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
> M       WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
> M       WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
> M       WEB-INF/lps/lfc/views/LzText.lzs
> 
> Changeset: 
> http://svn.openlaszlo.org/openlaszlo/patches/20100420-maxcarlson-4.tar
> 


Reply via email to