[Haskell-cafe] A tale of three shootout entries

Richard Kelsall r.kelsall at millstream.com
Tue Nov 27 09:41:18 EST 2007

Sterling Clover wrote:
> Finally, there's fasta.
> http://shootout.alioth.debian.org/gp4/benchmark.php?test=fasta&lang=ghc&id=2 
> This one really depresses me. It outperforms the previous version by 
> roughly 20% on my machine (PPC) but underperforms by roughly the same 
> amount on the shootout box.  

Well done. Great, I'll have a play with your new version of Fasta, I've
just upgraded to an Intel Core 2 Duo 2.33GHz.

Something I found with Dons version on my machine was that if I removed
all the exclamation marks and the -fbang-patterns bit at the top it went
about 20% faster as well as being much cleaner code, but with my very
rudimentary understanding of Haskell I wasn't entirely sure it would
produce the same results if I did this and didn't get round to checking.

I suspect the majority of Fasta time is spent in the rand routine. My
wild cunning plan for this was that it might be possible to avoid doing
the conversion to a float every time the routine is called. My thinking
is that it could just return an Int most of the time because the number
is only used in, I think, a less-than comparison outside rand which
could almost always be decided by an Int less-than comparison rather
than a float less-than comparison. A clever lazy less-than mechanism
could get rand to give a float when the Int comparison is too close to
be certain. Probably be classified by the shootout as cheating though.
And it's way beyond what I could currently write in Haskell.


More information about the Haskell-Cafe mailing list