[Pharo-project] Waste of CPU Power by polling events?
Henrik Sperre Johansen
henrik.s.johansen at veloxit.no
Tue Nov 23 10:23:27 CET 2010
On 22.11.2010 22:08, Guido Stepken wrote:
> Need additional:
You could try checking out how the iOS code does support for complex events.
It's of course somewhat apple-specific, but hey, would be nice to have
the same image-side representation and handling of touch-based events if
> I fear, that this costs a lot of wasted VM Power by polling. UNIX,
> especially Linux is changing towards a event machine, driven by
> interrupts. So - Interpreters should also migrated from polling to
> interrupt driven event-machines.
> I am missing that in Pharo. Pharo still has too much polling
> code/algorithm running, that slows down Pharo/Squeak/Etoys ...
> Any ideas appreciated ...
> tnx, regards
> Guido Stepken
At least for the input events, it is possible to avoid image-side
polling if your VM signals the input semaphore.
The Mac vm does it (haven't checked the unix vm, it might too), so if
you're able to use that, you can swap out the InputEventPollingFetcher
with InputEventFetcher to test how it works. Searching the list should
give an example of how to do it properly, transfering existing handlers etc.
With that, you should also be able to rewrite the polling Morphic loop
to redraw as response to input handling that causes display
invalidation, rather than process the available events as part of each
More information about the Pharo-project