Phil Wallach

I follow where my mind leads …

Phil Wallach header image 2

OpenLaszlo: initstage … defer vs late

August 8th, 2007 · No Comments

I have been playing around with the initstage property on views, in order to enhance performance (references below).  The initstage property tells OpenLaszlo when to complete initialisation after the object has been instantiated.

The Manual

initstage 
The execution of a node’s init method and sending of the oninit event is under the control of its initstage attribute, as follows:

immediate The init method is called immediately as the last stage of instantiation.
early The init method is called immediately after the view and its children have been instantiated.
normal The init method is called when the parent is initialized.
late The init method is called during idle time. To check whether init has been called, check the isinited property. Force calling init using the completeInstantiation method.
defer The init method will not be called unless explicitly requested by the completeInstantiation method.

My Experience

For many of my views I was using “late”, but I decided to change it to “defer” to squeeze out some more performance.  All views would only be instantiated on demand.

However the result was not what I expected.  The performance was actually worse, because the delay when views became visible was even more noticeable than before.  The requirement to initialise the views just-in-time lead to a noticeable lag in the UI.

It seems the “late” initialisation, using idle time, was quite efficient. So now I have changed everything back.

References

OpenLaszlo: optimising for a large number of views
OpenLaszlo: background loading of images

Tags: OpenLaszlo

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment