[Laszlo-dev] For Review: Change 20090501-ptw-Y Summary: Repair profiler for DHTML, tweak Class substrate

André Bargull andre.bargull at udo.edu
Sat May 2 04:16:05 PDT 2009


One minor improvement:

> +Instance.prototype.addProperties(['addProperty', function addProperty(name, value) {
> +      this.addProperties(arguments);
> +    }]);

It's more efficient to create an array here instead of using the 
arguments object. The array solution was about 20%-30% faster, tested 
with swf8, swf9, dhtml (FF3, Saf3, Opera9). You can verify with this 
simple testcase:

<canvas debug="true">
<button>
   <handler name="onclick"><![CDATA[
     var o = {
       addProps: function (a) {}
      ,addProp: function (n,v) {
         // this.addProps(arguments);
         // accessing arguments is slow
         this.addProps([n,v]);
       }
     }

     if ($as3) {
       var MAX = 1000000;
     } else {
       var MAX = 100000;
     }
     var start = new Date();
     for (var i = 0; i < MAX; ++i) {
       o.addProp("foo", null);
     }
     Debug.write(new Date().getTime() - start);
   ]]></handler>
</button>
</canvas>



On 5/2/2009 1:03 AM, P T Withington wrote:
> [Looking for a volunteer to review.  Max or Henry, if you can try using 
> this to profile wt and attach the results to 8106 that would be great 
> (feel free to delete the older profile results).]
> 
> Change 20090501-ptw-Y by ptw at dueling-banjos.home on 2009-05-01 18:33:57 EDT
>     in /Users/ptw/OpenLaszlo/trunk-2
>     for http://svn.openlaszlo.org/openlaszlo/trunk
> 
> Summary: Repair profiler for DHTML, tweak Class substrate
> 
> Bugs Fixed:
> LPP-5637  profiler does not give class method belongs to in DHTML
> LPP-8016  Performance differences between OL 4.0.x and 4.3.x (partial)
> 
> Technical Reviewer: (pending)
> QA Reviewer: (pending)
> Doc Reviewer: (pending)
> 
> Details:
>     LaszloEvents: Note class name on event
> 
>     platform/js2/Instance.js: Remove unused
> 
>     Class: Hoist the loop around addProperty into addProperties to
>     reduce function call overhead.  Remove static initializers --
>     these were not supported by JS2 classes, so we no longer use
>     them.  Remove validateClassStructure, no longer needed.
>     Hand-optimize `is` to `instanceof`, remove unnecessary `call` and
>     `apply`.  Add some profiling names.
> 
>     JavascriptGenerator, CodeGenerator: optimize profiling annotation
>     slightly.
> 
>     JavascriptGenerator: Correct profiling function name annotation.
> 
> Tests:
>     Run the profiler in DHTML, see the class names.  Notice slight
>     improvement in cost of addProperty.
> 
> Files:
> M      WEB-INF/lps/lfc/events/LaszloEvents.lzs
> D      WEB-INF/lps/lfc/compiler/platform
> D      WEB-INF/lps/lfc/compiler/platform/js2
> D      WEB-INF/lps/lfc/compiler/platform/js2/Instance.js
> M      WEB-INF/lps/lfc/compiler/Class.lzs
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
> 
> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090501-ptw-Y.tar
> 


More information about the Laszlo-dev mailing list