[Haskell-cafe] Optimizing cellular automata evaluation (round 2)
jgbailey at gmail.com
Fri Nov 30 11:18:16 EST 2007
On Nov 29, 2007 4:45 PM, Felipe Lessa <felipe.lessa at gmail.com> wrote:
> Why don't you use an UArray of Bools? They're implemented as bit
> arrays internally, AFAIK (e.g. see
> http://www.haskell.org/haskellwiki/Shootout/Nsieve ). And then you
> would get rid of a lot of shifts and masks in your code -- clearer and
> faster, the Haskell Way (TM).
fill, fillE and fillS are all looking at a integer value, and not
doing any array access. I'm skeptical that an array of bools, even if
its internally a mask on an int, could be faster.
> Well, I guess it would be faster, but I can't really tell. Could you
> provide a main function implementing an "use case" for benchmark?
Sure, here is one
ghc -O2 --make Test.hs
It runs a random rule for 1000 steps.
More information about the Haskell-Cafe