Status: New
Owner: ----

New issue 3562 by [email protected]: Deferred UI messages executed slowly
http://code.google.com/p/pharo/issues/detail?id=3562

Pharo1.2rc1
Latest update: #12313

Processing deferred ui messages seems to be really slow. You can test it by executing this:

| rnd |
rnd := Random new.
100 timesRepeat: [
        WorldState addDeferredUIMessage: [
                Morph new openInWorld; center: rnd next @ rnd next * Display 
extent.
                ]
        ].

You'll notice it takes a couple of seconds to finish opening all the morphs, but if you remove the #addDeferredUIMessage: send, it is instantaneous. In Squeak and Etoys both versions are equally fast.

I think the bug is in WorldState>>#runStepsMethodsIn:. It seems it only executes one deferred ui message per step. With the implementation below the problem is fixed.

WorldState>>#runStepMethodsIn: aWorld
        "Perform periodic activity inbetween event cycles"
        | queue nextInQueue|

        "If available dispatch some deferred UI Message"
        queue := self class deferredUIMessages.
        [(nextInQueue := queue nextOrNil) isNil]
                whileFalse: [ nextInQueue value].

        self runLocalStepMethodsIn: aWorld.



Reply via email to