[racket] Performance difference between BSL and #lang racket

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Sun Jan 15 13:59:33 EST 2012

On 1/12/12 2:48 PM, Jordan Johnson wrote:
> Hi all,
>
> A student presented me this morning with an implementation he'd written of Pong, which, after about a minute and a half of running (in BSL) was so slow on his Mac that it was unusable; specifically, the apparent speed slowed down a lot, and the game stopped responding to key input.  I found the same thing happened on Win 7, but if I ran the same program under #lang racket, no such slowdown occurred.  It appears that there's some memory growth over time (maybe about 1K per five or ten seconds) in BSL too.
>
> What language difference(s) might be responsible for the vast performance difference we're observing?  If it would be helpful to see the code I can share it, but it's about 1000 LoC and I don't think it's proper to post it publicly.  I've tried to construct a small program that shows the same difference, but haven't managed; I don't, however, see anything in his code that would be obviously responsible.
>
> Thanks for any insight you might be able to offer.

I bet it's exact arithmetic.  Racket sees 1.2 as an inexact number, 
while *SL sees it as exact.  Try inserting "#i" before any literal 
numbers in the code and see if that does the trick.

David


Posted on the users mailing list.