Change 20080910-maxcarlson-p by [EMAIL PROTECTED] on 2008-09-10 18:31:55 PDT
    in /Users/maxcarlson/openlaszlo/pagan-deities
    for http://svn.openlaszlo.org/openlaszlo/branches/pagan-deities

Add persistent CSS caching

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

Technical Reviewer: pkang
QA Reviewer: promanik

Details: Updated to only cache values the first time. Lee sent a profile log that showed 372 calls after the cache had been run. I added a flag when the cache is initialized. Then, values are only cached the first time.

I wanted to get this cleaned up and sent out. It reduces the number of __LZapplyStyleMap() calls from 115 to 8(!), and the startup time by 830ms with no regressions. I'm curious if this works with the webtop codebase.

LzSprite.as - Add csscache capability, set to true. Add getCSSCache() method that returns a cache, automatically invalidating if the app fingerprint changes, indicating it was recompiled or changed.

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

LzNode.lzs - If csscache capability is true, store and restore CSS application results using the persistent cache.

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

CanvasCompiler.java - Set canvas.builddate to the date/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 start up fater. 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.0% 0.27 0.27 1 271.34 276.64 LzSprite.prototype.getCSSCache [27] 5.9% 0.47 0.20 131 1.53 2.34 LzCSSStyle.getRulesCache [21] 4.3% 0.62 0.15 337 0.43 4.72 <node>/ <node> [6] 3.8% 0.75 0.13 338 0.38 1.17 <node>/ __LZapplyArgs [17] 2.5% 0.83 0.09 233 0.37 0.37 LzTextSprite.prototype.getTextfieldHeight [61] 2.3% 0.91 0.08 1000 0.08 0.20 LzDelegate/ register [34] 2.2% 0.99 0.07 293 0.25 0.39 LzTextSprite.prototype.setWidth [47] 2.1% 1.06 0.07 1155 0.06 0.10 Class.addProperty [49] 2.0% 1.13 0.07 2043 0.03 0.03 Instance/ AddProperty [78] 1.9% 1.19 0.06 2265 0.03 0.03 LzCSSStyle.__compareSpecificity [85] 1.7% 1.25 0.06 56 1.04 12.92 <node>/ __LZcallInit [10]
...
0.0% 3.40 0.00 1 0.01 0.01 LzCSSStyleDeclaration [812]



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

4.9% 0.13 0.13 337 0.37 3.64 <node>/ <node> [6] 4.8% 0.25 0.12 338 0.37 1.09 <node>/ __LZapplyArgs [16] 3.2% 0.33 0.08 299 0.28 0.73 <view>/ construct [25] 3.2% 0.41 0.08 233 0.35 0.35 LzTextSprite.prototype.getTextfieldHeight [50] 2.8% 0.49 0.07 1155 0.06 0.10 Class.addProperty [41] 2.7% 0.55 0.07 2043 0.03 0.03 Instance/ AddProperty [59] 2.4% 0.62 0.06 1000 0.06 0.17 LzDelegate/ register [31] 2.1% 0.67 0.05 636 0.08 0.10 LzEvent/ LzEvent [64] 1.9% 0.72 0.05 56 0.89 10.03 <node>/ __LZcallInit [11] 1.7% 0.76 0.04 318 0.14 1.11 <node>/ applyConstraint [17] 1.6% 0.80 0.04 211 0.19 0.56 LzSprite.prototype.setResource [40]
...
0.0% 2.57 0.00 1 0.01 0.01 LzCSSStyleDeclaration [815]

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/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/20080910-maxcarlson-p.tar

Reply via email to