[Laszlo-dev] For Review: Change 20090423-ptw-I Summary: Disable idle loop when there is nothing to do

André Bargull andre.bargull at udo.edu
Sat Apr 25 09:53:21 PDT 2009


LzIdleKernel
- addCallback(): if you push values onto the "__callbacks"-stack, its 
length will always be greater than 0, won't it?
> +      __callbacks.push(scope, funcname);
> +      if ((__callbacks.length > 0) && (! __listening)) {

- removeCallback(): if callbacks can't be installed twice, you can 
safely break from the loop after you've found the first result
> +        if (__callbacks[i] === scope && __callbacks[i + 1] == funcname) {
> +          var removed:Array = __callbacks.splice(i, 2);
>          }


Otherwise approved.


On 4/24/2009 1:10 AM, P T Withington wrote:
> [cc-ing several Technical reviewers, as you've each had a hand in this 
> code at one time or another. This patch is against trunk, if it is 
> successful, I will look into migrating it to 4.2.0.3]
> 
> Change 20090423-ptw-I by ptw at dueling-banjos.home on 2009-04-23 16:30:21 EDT
>     in /Users/ptw/OpenLaszlo/trunk-3
>     for http://svn.openlaszlo.org/openlaszlo/trunk
> 
> Summary: Disable idle loop when there is nothing to do
> 
> Bugs Fixed: LPP-8072 CPU usage staying at 20% (on a dual core machine)
> 
> Technical Reviewer: hminsky, max, a.bargull at intensis.de (pending)
> QA Reviewer: ammar.tazami at g.ho.st (pending)
> 
> Details:
>     Create a custom event for the idle event that knows how to
>     register itself for callback from the idle kernel when there are
>     delegates.  Most importantly, it unregisters itself when there are
>     no delegates.  For each of the LzIdleKernel's also make it
>     register/unregister from the runtime callback, depending on
>     whether there is anything to do.  This seems to save a significant
>     amount of CPU overhead, especially in DHTML (down from 8% to
>     0.5%).  The Flash plug-in seems to have a floor of about 6% that
>     is beyond my control.
> 
>     LzTimeKernel:  Eliminate swf7 cruft.
> 
>     LzIdleKernel.*:  Simplify the callback storage as a plist instead
>     of an alist.  Make sure the same callback can't be installed
>     twice.  Implement register/unregister strategy per above.  Tweak
>     the code to be a little more efficient.  Since the idle loop only
>     runs when necessary now, we no longer need to hide it from the
>     profiler.
> 
>     LFCApplication:  Leave the registering of the idle kernel to it.
> 
>     kernel/Library:  Remove some svg cruft that triggers warnings in
>     the schema generator.
> 
>     LzIdle:  Add the new event auto-registering subclass.  Use that
>     instead of always calling __idleupdate.
> 
>     LaszloEvents:  For now, have to un-final this.  <sigh />
> 
>     dev-console.*, bezel_inner_up:  Recompile the dev consoles to get
>     the benefit of these changes (otherwise the console swamps the cpu
>     savings in the app).
> 
> Tests:
>     (Amended) test case from bug report.  With these changes in place,
>     the Firebug profiler shows that there is _no_ javascript execution
>     once the instantiator is finished replicating views.  In
>     swf8/swf9, the cpu usage (as reflected by process monitoring the
>     browser) is greatly reduced (although not quite to the level of a
>     static .swf, so more work may be needed).
> 
> Files:
> M      WEB-INF/lps/lfc/kernel/swf/LzTimeKernel.as
> M      WEB-INF/lps/lfc/kernel/swf9/LzIdleKernel.as
> M      WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as
> M      WEB-INF/lps/lfc/kernel/Library.lzs
> M      WEB-INF/lps/lfc/kernel/LzIdleKernel.lzs
> M      WEB-INF/lps/lfc/services/LzIdle.lzs
> M      WEB-INF/lps/lfc/events/LaszloEvents.lzs
> M      lps/admin/dev-console.lzx.js
> M      lps/admin/dev-console.lzx.swf
> M      
> lps/admin/lps/resources/lps/components/lz/resources/autoPng/bezel_inner_up.sprite.png 
> 
> 
> 
> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090423-ptw-I.tar
> 


More information about the Laszlo-dev mailing list