[racket] universe program using 100% cpu on Mac (also poor Raspberry Pi performance)

From: Darren Cruse (darren.cruse at gmail.com)
Date: Mon Dec 29 10:46:58 EST 2014

Re:

> Could you post the code somewhere so we can experiment with it?


Here it is it's all in one file:
pong-world.rkt
<https://github.com/darrencruse/pong-world-racket/blob/master/pong-world.rkt>

On Mon, Dec 29, 2014 at 8:05 AM, Matthias Felleisen <matthias at ccs.neu.edu>
wrote:

>
> On Dec 28, 2014, at 9:51 PM, Darren Cruse wrote:
>
> One thing I can see is that on-draw is called for every on-tick on all
> three platforms btw.
>
> And even in cases where the program is idling and on-tick has simply
> returned the world state it was given unmodified.
>
> Is that normal I wonder?  Part of me thought that since to-draw is a
> function of the world state, and the world state hasn't changed, that it
> would *not* call to-draw in that case.
>
>
> I experimented with this 'optimization' and, if I recall correctly, it
> didn't make much of a difference and got in the way of imperative world
> programs. So I took it out. Mea culpa, I should have commented on this
> experiment inside the code.
>
>
>
> (but it calls to-draw for every on-tick even on the Windows machine which
> is using only 6% cpu - so maybe I'm wrong to look to that as the problem)
>
>
>
> My Mac-based experiments suggest that this call is not the cause of
> performance problems.
>
> ;; ---
>
> Could you post the code somewhere so we can experiment with it?
>
> Thanks -- Matthias
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141229/95855159/attachment.html>

Posted on the users mailing list.