<div dir="ltr"><div dir="ltr">On Tue, Sep 1, 2020 at 8:36 AM Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Tony,<br>
<br>
<br>
> On Sep 1, 2020, at 6:50 AM, Tony Garnock-Jones <<a href="mailto:tonyg@leastfixedpoint.com" target="_blank">tonyg@leastfixedpoint.com</a>> wrote:<br>
> <br>
> It occurs to me that to get better power efficiency, Squeak may need to<br>
> learn how to go to sleep more often. At present it's using about a<br>
> quarter of a core on my phone when I'm not doing anything to it.<br>
> <br>
> JIT could help that, I guess; but more generally, it'd be nice just not<br>
> to be awake when there's nothing pressing to do...<br>
<br>
The solution is a modified event architecture and jettisoning relinquishProcessorForMilliseconds:.  Search the archives (squeak-dev & vm-dev) for “event driven vm”.  This is work that should have been done a long time ago (I did this for the VisualWorks vm back at the turn of the century or thereabouts).  But it isn’t going to get done unless someone steps up.  My input queue is full to overflowing.<br>
</blockquote><div><br></div><div>Not just the VM, but we would also need to modify the image to be event-driven.</div><div><br></div><div>A lot of Morphic code works by polling for changes in state (typically in a "step" method), rather than reacting to events. That is almost elegant in its simplicity, but rather wasteful. It was designed before power consumption became an issue we care about. Nowadays, Morphs should only be stepping if they are actively animating something without user input. </div><div><br></div><div>Basically, the UI process should sleep until there is an event, which could be a user event, a timer event, or some asynchronous state change (like a network package arrived, etc).</div><div><br></div><div>I guess Morphic can accommodate that, or it might need a larger re-design. E.g. Tweak was designed around every UI element running in a separate thread, and sleeping until there was actually something to do.</div><div><br></div><div>- Vanessa - </div></div></div>