[racket] Mutable state vs RAM on fire

From: joshua at anwu.org (joshua at anwu.org)
Date: Wed May 2 21:25:41 EDT 2012


Heh... I guess that information would be relevant. :)

Not looking for any particular performance numbers, just that it could finish
without sucking up all the RAM and thrashing about the swap.  I've been
feeding it up to 1000 deg-6 polynomials to multiply as tests.  The imperative
versions (Perl, JS, and Racket) all handle this fine.  The first Racket
version I wrote using a-lists blew up to 4G of memory at 10 polynomials.

I suspect it's related to what DY said about needing to simplify polynomaials
between multiplications.

I just finished a third iteration, this one using hash tables.
This one has no mutable state, and runs much faster than my alist version.
Is not as fast as the mutable vector version, or even the Perl version,
but one can't have everything... it's at least in the same order of magnitude, now.

https://github.com/TurtleKitty/Dice/blob/e69dc696f4d36a7dfdb6ec28676f5c002f5de6b1/dice.rkt

This process has been educational.


tk
(Also fixed a couple of bugs and added a histogram.)


On Wed, May 02, 2012 at 08:52:25PM -0400, Deren Dohoda wrote:
> What sort of time are you looking for for it to be "handled"?
> 
> Deren
> 

Posted on the users mailing list.