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

From: Darren Cruse (darren.cruse at gmail.com)
Date: Sun Dec 28 21:51:01 EST 2014

Hi been working thru the How to Design Programs book with a meetup here in
St Louis.

Just finished writing a pong game and though the performance is acceptable
on a normal laptop I was a little surprised how poorly it runs on a
raspberry pi...

Not that I'm that worried about the pi, but it started me looking a little
closer at performance and wondering if I've written things in a way that
hurts performance.

The first thing I noticed is cpu usage was high even when nothing was
happening in the game (e.g. when the pong game was just idling and there
was no movement on the screen at all).

In fact I noticed on my MacBook the program sits on 100% cpu all the time!

But on my little ubuntu netbook (chromebook running ubuntu) the same
program sits at about 30% cpu.

And on a Windows 8.1 laptop it's only taking 6% cpu.

These numbers are when running with command line racket not thru drracket
btw.

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.

(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)

Could it be on Windows the graphics drawing is GPU accelerated but on the
Mac it's not?  i.e. maybe on the Mac all drawing done with the CPU alone?

Or could this be an actual bug in racket I wonder?

Lastly - and again it's not a big deal I'm just curious - do people think a
program like this should be able to run with racket on the Pi?  Or is the
Pi too underpowered for universe programs with racket?

Thanks,

Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141228/be1f9d61/attachment-0001.html>

Posted on the users mailing list.