Waiter About

Waiter used as Frame progress keeps updating the stage after loading (ZIM 018–020)

When a Waiter is passed as progress to Frame, Waiter.show() adds createjs.Ticker.on("tick", () => stage.update()). After loading, Frame calls progress.hide(), but hide() only removes the Waiter from the stage. The Ticker listener (and the looping dot tweens) are only removed in dispose(), which Frame never calls.
Result: the stage is redrawn every frame for the whole life of the app, even when nothing changes. We measured 60–120 stage.update() calls per second on an idle page. On mobile with gpu:true this costs battery and causes heat.
Repro: new Frame({assets:[…], progress:new Waiter(), ready(){}}), then count stage.update() calls after ready.
Suggested fix: turn off w.ticker and remove the dot tweens in hide() (and add them again in show()), or have Frame call dispose() on the progress object after loading. Artificial intelligence suggested this. I don’t actually know, from a technical standpoint, whether it’s problematic. Could you take a look and check? Does it really affect performance?

Thanks - will take a look - if that is indeed the case, it would an improvement to remove it.

Yes - that was the case. The Ticker was left. This was coded ages ago and used createjs tween directly with a createjs Ticker. Sigh. Thanks for the find. It has been patched in ZIM 020. We could retro fix back versions. But that is always dangerous to do. So, the system is, check https://zimjs.com/updates.html and look for improvements to see if any will improve older version performance and if so, then update the ZIM, and check your app, obviously.

1 Like