VM questions

Lex Spoon lex at cc.gatech.edu
Mon Jan 8 17:38:49 UTC 2001

Marcel Weiher <marcel at metaobject.com> wrote:
> Another couple of questions that cropped up while doing the VM and  
> translation work:
> 1.	Polling for events
> Squeak seems to poll quite vigorously for events, undeterred by the  
> fact that nothing is happening. I also see it sucking significantly  
> more CPU in Morphic than in MVC when idle, which doesn't really seem  
> to be the desired behavior for an event-based system.  The CPU usage  
> for idle Morphic is also somewhat bursty.
> Should I simply put it too sleep in the event-getter code if there  
> are no events, or is this a bad idea?  I should mention that the VM  
> is multi-threaded.

Everyone has their opinion on this.  In my view, Morphic *already* goes
to sleep when it's not doing anything, so why bother second-guessing it
in the VM?  You might experiment instead with changing how
interCyclePause: works.  If the Morphic loop can figure out that the VM
really supports input events, then it could try sleeping until either an
event comes in or until a #step method needs to be run.

Before you go too far, however, it's worth trying to figure out where
the CPU usage is actually going.  In particular, you might well be seeing
browser windows refresh themselves.  To test this, try going to a
morphic project that has no SystemWindows and no flaps on the screen,
but which may well have other kinds of morphs.  Does the CPU usage go


More information about the Squeak-dev mailing list