[racket] universe program using 100% cpu on Mac (also poor Raspberry Pi performance)
Happy New Year to all of you and thanks for all the thoughtful replies.
This thread has multiple themes so speaking to each individually:
a. Testing
Regarding my poor attitude towards TDD... :) I have been trying to take
everyone's comments to heart and have been attempting to get that black
background stuff off of drracket for my pong program!!
I have made some progress but I did want to ask a few pragmatic questions:
a1. Do people *truly* go for 100% coverage i.e. *truly* get rid of all the
black background stuff?
a2. One kind of funny question - I attempted to add a test of my main
function - which calls big-bang - esp. since drracket's showing the black
background on that. Something like this:
(check-expect (main initial-world) expected-world)
(define (main world)
(big-bang world
[name "Pong World"]
[on-tick handle-tick]
[to-draw draw-pong-world]
[on-pad handle-key-down]
[on-release handle-key-up]
[on-mouse handle-mouse]
[stop-when quitting? draw-goodbye]))
But my fears were realized when check-expect calling that truly pops up the
window and runs the program for real!! Which I guess makes perfect sense.
But - is there a way to avoid that? Seems like somehow I need some kind of
"headless" way to test big-bang...
a3. I also have quite a few of these "setter"/"updater" type of functions
for copying a structure but setting one of it's values. Here's one for an
example:
(define (pong-world-set-ball world ball)
(make-pong-world
(pong-world-status world)
ball
(pong-world-left-paddle world)
(pong-world-right-paddle world)
(pong-world-left-score world)
(pong-world-right-score world)))
Any tips on how you'd approach testing these type of functions?
b. Poor performance of my pong game on Raspberry Pi (running linux)
I just now stumbled on this article about racket's JIT not being enabled by
default on the pi.
<http://www.reddit.com/r/programming/comments/1hryxt/racket_on_raspberry_pi_the_importance_of_being/>
And aside from that I've learned it's known that graphics intensive
programs struggle on raspberry pi under X Windows. They're working on a
new graphics system "Wayland"
<http://www.linux.com/news/embedded-mobile/mobile-linux/721510-raspberry-pi-gains-graphics-speed-as-wayland-replaces-x>
to
solve the problem.
And looking closer at the top command while running my pong program racket
was consuming like 30-40% cpu but X windows was using the remaining 60-70%!
If anybody's interested in Pi-like devices I should clarify that I'd had
better luck with less cpu intensive racket demos I've tried. e.g. racket
gui
<http://docs.racket-lang.org/gui/windowing-overview.html#%28part._.Creating_.Windows%29>
demos
seem to run well for me on the pi.
Lastly too I should mention I just got this raspberry pi competitor
<http://ameridroid.com/products/odroid-c1> and the pong game does run
pretty decent on that (both in racket and in chrome with the whalesong
version).
c. Whalesong
Mattias sorry to hear the Whalesong version didn't work for you. When I
read your note I tried it on more devices I have and I have to say it's
working pretty well for me I think the only time I saw problems was e.g. on
an android tablet where I tried to use the older stock android web browser
instead of like chrome or firefox.
What device and browser were you on I wonder?
Also if anybody's interested I was able to add support for on-release
pretty easily to Whalesong and my change was just merged into Jens Axel
Søgaard's fork <https://github.com/soegaard/whalesong>
d. Moby
Hi Emmanuel it's cool your doing stuff with Moby I'm interested but a
little bit confused as I google on Moby so many references say Whalesong is
meant to replace Moby?
But my bigger question is I'm having trouble following exactly what the
architecture of Moby is/was?
It says it was targeting android but I also see javascript mentioned, yet I
also see it uses an apk? So is/was it a phonegap type of an approach?
i.e. A native app that used a web view wrapper to execute javascript?
Or was it truly a java port of the racket VM? You said it uses "the old
bytecode interpreter" so maybe I'm misunderstanding about it being
javascript?
Sorry for writing too much maybe I should have split this thread up...
Darren
On Thu, Jan 1, 2015 at 7:10 PM, Emmanuel Schanzer <
schanzer at bootstrapworld.org> wrote:
> Just to clarify: what I’ve got is a re-do of *Moby*, not whalesong. All
> the generated code still runs on the old bytecode interpreter. You’re
> definitely not going to get anything close to good runtime performance from
> my compiler.
>
> (However, Whalesong and Moby share a *lot* of runtime code, and the
> world-events section of both are nearly identical. My mouse-event code
> should be practically copy-and-pasteable into Whalesong...)
>
> Emmanuel Schanzer
> -----------------------------
> Bootstrap Program Director
> 617-792-2438
> schanzer at bootstrapworld.org
>
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150102/9e79ad63/attachment-0001.html>