Author: max
Date: 2007-08-02 10:18:46 -0700 (Thu, 02 Aug 2007)
New Revision: 5910

Modified:
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/core/LzNode.lzs
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/events/LaszloEvents.lzs
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/services/LzCSSStyle.js
Log:
 20070801-maxcarlson-V by [EMAIL PROTECTED] on 2007-08-01 20:51:00 PDT
    in /Users/maxcarlson/openlaszlo/wafflecone
    for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

Summary: More optimization of LFC

New Features:

Bugs Fixed: LPP-4414 - Improve startup performance (partial)

Technical Reviewer: promanik
QA Reviewer: ben
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzCSSStyle.js - Cache getPropertyValueFor() calls.  Only call 
_selectorApplies() for compound css statements.

LzNode.lzs - Only call constructWithArgs() if it exists.

LaszloEvents.lzs - Check for null reference.
    

Tests: ...silver/main.lzx?lzr=dhtml&lzt=html shows ~24029 fewer total calls 
(252524 total before, 228495 now).  
http://localhost:8080/wafflecone/test/style/constraints/main.lzx?lzr=swf8 
passes as before, shows 405ms for lookup test.



Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/core/LzNode.lzs      
2007-08-02 16:46:55 UTC (rev 5909)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/core/LzNode.lzs      
2007-08-02 17:18:46 UTC (rev 5910)
@@ -180,7 +180,11 @@
             this.__LZstyleConstraints = this.__LZapplyStyleMap( styleMap, 
attrs );
         }
 
-        this.constructWithArgs( maskedargs );
+        /**
+          * @todo 2006-05-24 ptw Adam says this is a hack that we should get
+          * rid of.
+          */
+        if (this.constructWithArgs) this.constructWithArgs( maskedargs );
 
         delete this.__LZdeferDelegates;
         if (qpos != LzDelegate.__LZdelegatesQueue.length) {
@@ -641,13 +645,6 @@
 }
 
 /**
-  * @access private
-  * @todo 2006-05-24 ptw Adam says this is a hack that we should get
-  * rid of.
-  */
-function constructWithArgs ( parent , args ){}
-
-/**
   * Called at the same time that the node sends its oninit event -- usually
   * when the node's siblings are instantiated, and always after the node's
   * children are instantiated.
@@ -1967,10 +1964,4 @@
   this.makeChild( dpobj , true);
 }
 
-
-/**
-  * @access private
-  */
-function constructWithArgs ( parent , args ){}
-
 } // End of LzNode

Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/events/LaszloEvents.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/events/LaszloEvents.lzs      
2007-08-02 16:46:55 UTC (rev 5909)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/events/LaszloEvents.lzs      
2007-08-02 17:18:46 UTC (rev 5910)
@@ -215,7 +215,7 @@
       }
       */
       // d.execute( sd ); inlined
-      d.c[d.f]( sd );
+      if (d.c[d.f]) d.c[d.f]( sd );
       i+=2;
     }
     evq.length = pos;

Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/services/LzCSSStyle.js
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/services/LzCSSStyle.js       
2007-08-02 16:46:55 UTC (rev 5909)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/services/LzCSSStyle.js       
2007-08-02 17:18:46 UTC (rev 5910)
@@ -70,6 +70,7 @@
     return 1 ;
 }
 
+LzCSSStyleRule.prototype.__pvcache = {};
 
 var LzCSSStyle = {};
 
@@ -90,6 +91,8 @@
     //var t = getTimer();
     if (!node) return;
     var uid = node.getUID();
+    var val = LzCSSStyleRule.prototype.__pvcache[uid + pname];
+    if (val) return val;
     var rules = this.__LZRuleCache[ uid ];
     if ( !rules ) {
         rules = new Array();
@@ -102,7 +105,7 @@
                  (rp.type == 3 && (((rp.classname in lz) && (node instanceof 
lz[ rp.classname ])) || ( (rp.classname in global) && (node instanceof global[ 
rp.classname ])))) ||
                  (rp.type == 5 && node[ rp.attrname ] == rp.attrvalue) ||
                  (rp.type == 6 && node[ rp.attrname ] == rp.attrvalue && 
(((rp.classname in lz) && (node instanceof lz[ rp.classname ])) || ( 
(rp.classname in global) && (node instanceof global[ rp.classname ])))) ||
-                 this._selectorApplies( r, rp, node ) ){
+                 (rp.type == 4 && this._selectorApplies( r, rp, node ))){
                 rules.push(r); 
             }
         }
@@ -124,7 +127,7 @@
                  (rp.type == 3 && (((rp.classname in lz) && (node instanceof 
lz[ rp.classname ])) || ( (rp.classname in global) && (node instanceof global[ 
rp.classname ])))) ||
                  (rp.type == 5 && node[ rp.attrname ] == rp.attrvalue) ||
                  (rp.type == 6 && node[ rp.attrname ] == rp.attrvalue && 
(((rp.classname in lz) && (node instanceof lz[ rp.classname ])) || ( 
(rp.classname in global) && (node instanceof global[ rp.classname ])))) ||
-                 this._selectorApplies( r, rp, node ) ){
+                 (rp.type == 4 && this._selectorApplies( r, rp, node ))){
                     rules.push(r); 
                 }
             }
@@ -148,7 +151,11 @@
     var i = 0; 
     while ( i < l ) {
         var props = rules[i++].properties;
-        if (pname in props) { return props[pname]; }
+        if (pname in props) { 
+            var v = props[pname];
+            LzCSSStyleRule.prototype.__pvcache[uid + pname] = v
+            return v; 
+        }
     }
 
     ////this.time1 += getTimer() - t;
@@ -316,7 +323,7 @@
                                 (inrp.type == 3 && (((inrp.classname in lz) && 
(icurnode instanceof lz[ inrp.classname ])) || ( (inrp.classname in global) && 
(icurnode instanceof global[ inrp.classname ])))) ||
                                 (inrp.type == 5 && icurnode[ inrp.attrname ] 
== inrp.attrvalue) ||
                                 (inrp.type == 6 && icurnode[ inrp.attrname ] 
== inrp.attrvalue && (((inrp.classname in lz) && (icurnode instanceof lz[ 
inrp.classname ])) || ( (inrp.classname in global) && (icurnode instanceof 
global[ inrp.classname ])))) ||
-                                this._selectorApplies( rule, inrp, icurnode )){
+                                (inrp.type == 4 && this._selectorApplies( 
rule, inrp, icurnode ))){
                                 if ( sindex-- == 0 ){
                                     iresult = true;
                                     break;


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to