Max Carlson | 6 Sep 03:50
Favicon

For Review: Change 20080905-maxcarlson-a Summary: UPDATED AGAIN: Move property cache lookups to LzNode, add persistent CSS cache

Change 20080905-maxcarlson-a by maxcarlson <at> Bank on 2008-09-05 13:34:45  
PDT
     in /Users/maxcarlson/openlaszlo/pagan-deities
     for http://svn.openlaszlo.org/openlaszlo/branches/pagan-deities

Summary: UPDATED AGAIN: Move property cache lookups to LzNode, add  
persistent CSS cache

Bugs Fixed: LPP-6938 - Improve CSS performance (partial)

Technical Reviewer: ptw
QA Reviewer: promanik

Details: Adding a persistent cache is crazy, but I tried it anyway.   
It turns out to reduce the number of calls to getPropertyValueFor() by  
289, and the total time spent by .19 seconds, with no regressions!

LzSprite.as - Add csscache capability, set to true

LzSprite.js,LzSprite.lzs - Add csscache capability, set to false

LzCSSStyle.js - Remove property value caching.

LzNode.lzs - Inline property value caching.  If csscache capability is  
true, restore the value from the persistent cache.

LaszloCanvas.lzs - Document and store canvas.builddate property from  
CanvasCompiler.java.  If csscache capability is true, restore the  
__LZcsscache property.

CanvasCompiler.java - Set canvas.builddate to the time when the  
application is built.

Tests: http://localhost:8080/pagan-deities/test/style/metasuite.lzx  
runs as before.  Note the first time is slower because it builds the  
cache.  Subsequent loads (without recompilation) should be faster by a  
lot.  Validate the profiler results by rebuilding the LFC, profiling
http://localhost:8080/pagan-deities/test/style/metasuite.lzx?lzr=swf7&profile=true&lzt=html 
.  Save the profiler results, then refresh the app and run again and  
you should see the hotspot go away:

Before:
         %  cumulative     self    calls     self    total   
name                                                          index
      time     seconds  seconds           ms/call  ms/call

       8.2%       0.29     0.29      347     0.84     1.00   
LzCSSStyle.getPropertyValueFor                                [19]
       7.2%       0.55     0.26        1   256.42   261.50   
LzSprite.prototype.__initCSSCache                             [27]
       3.7%       0.68     0.13      337     0.39     5.19  <node>/ 
<node>                                                 [6]
       3.7%       0.81     0.13      338     0.39     1.35  <node>/ 
__LZapplyArgs                                          [16]
       2.8%       0.91     0.10      233     0.43     0.43   
LzTextSprite.prototype.getTextfieldHeight                     [58]
       2.2%       0.99     0.08     1000     0.08     0.20  LzDelegate/ 
register                                           [36]

After:
         %  cumulative     self    calls     self    total   
name                                                          index
      time     seconds  seconds           ms/call  ms/call

       4.3%       0.13     0.13      338     0.37     1.27  <node>/ 
__LZapplyArgs                                          [17]
       4.2%       0.25     0.12      337     0.36     4.23  <node>/ 
<node>                                                 [6]
       3.9%       0.36     0.11       58     1.98     2.34   
LzCSSStyle.getPropertyValueFor                                [41]
       3.6%       0.47     0.11      318     0.33     1.45  <node>/ 
applyConstraint                                        [15]
       3.1%       0.56     0.09      233     0.38     0.38   
LzTextSprite.prototype.getTextfieldHeight                     [51]

Once again, I'm curious to see if you see results from running webtop.

Files:
M      WEB-INF/lps/lfc/kernel/swf/LzSprite.as
M      WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
M      WEB-INF/lps/lfc/kernel/swf9/LzSprite.lzs
M      WEB-INF/lps/lfc/services/LzCSSStyle.js
M      WEB-INF/lps/lfc/core/LzNode.lzs
M      WEB-INF/lps/lfc/views/LaszloCanvas.lzs
M      WEB-INF/lps/server/src/org/openlaszlo/compiler/ 
CanvasCompiler.java

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080905-maxcarlson-a.tar


Gmane