To template or to lock?

David Bovill david.bovill at gmail.com
Sun Feb 7 14:27:52 EST 2010


Yes - but why does locking the screen nearly double the speed in the case
where you set template properties and the only actual step that draws to
screen is a single one - create graphic? Locking and unlocking should surely
make no difference here?

on mouseUp
>    put the ticks into startTick
>    set lockmessages to true
>    repeat 100
>       set the style of the templategraphic to "rectangle"
>       set the linesize of the templategraphic to random (8)
>       set the opaque of the templategraphic to true
>       set the loc of the templategraphic to the loc of this cd
>
>       create graphic "Test"
>       reset templategraphic
>    end repeat
>    set lockmessages to false
>    put the ticks - startTick
> end mouseUp
>

On 7 February 2010 18:52, Malte Pfaff-Brill <revolution at derbrill.de> wrote:

> Hi,
>
> a bit late to the party, but I think I´ll throw in my observations anyway.
>
> The locking of the screen is a crucial part of the equotation. What takes
> the most time (in a standalone application, getting back to this later) is
> the screen refresh after anything that affects a "visual" property of a
> control. So if you you set properties without the screen locked, this can
> take significantly longer than using the template*youNameTheControl*. If the
> screen is not locked there, it needs to be redrawn for each setting of a
> property. If the screen is locked the screen will be redrawn only once, as
> soon as an unlock screen happens, or the handler ends (for the record,
> adding unlock screen at the end of the handler instead of letting the engine
> figure it out is slightly faster than letting the engine do it). However,
> this comparison is not really fair. It gets fair, as soon as you set the
> properties of the templat*whatEverControl* with a locked screen. If you do
> that, I could not measure any real difference between the two methods. Now
> getting back to why I wrote "in a standalone application" earlier. In the
> IDE you will get a huge speed penaltie for all the IDE messages that are
> being sent, once a control is created. This is even costier than the screen
> refresh. So for optimal performance in the IDE I would lock screen, and if
> possible also lock messages. If you use the template*whatever* then or set
> properties, is a matter of taste if you go for a one object creation. If you
> need to create more than one object, then the template has the advantage of
> being able to producing a few lines less code under some circumstances.
>
>  Just 2 cents,
>
> Malte_______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list