[Haskell-cafe] Language Shootout reverse-complement benchmark

Louis Wasserman wasserman.louis at gmail.com
Mon May 31 20:47:52 EDT 2010


Hey,

I was looking at the reverse-complement benchmark on the Language Shootout,
and among other things, I noticed that the Haskell implementation was using
(filter (/= '\n')) on ByteStrings, and also using lists as queues.

I had a few improvements which using -fasm seem to yield about a 19%
improvement in speed, and a 35% reduction in allocation, on my computer.
 (If both programs are compiled with -fllvm -- I'm not sure whether or not
that's fair game on the Shootout -- my implementation is 35% faster, and
does 10% less allocation.)  I've checked my code on the Shootout's test
input, as well.

Mostly, the improvement comes from a tightly specialized version of (filter
(/= '\n')), although eliminating an intermediate list entirely (and one used
in a queuelike fashion) didn't seem to hurt.  I managed to cut the program
to a point where the program size is about the same as before.

The code is at http://hpaste.org/fastcgi/hpaste.fcgi/view?id=25865; the
previous implementation is at
http://shootout.alioth.debian.org/u32/program.php?test=revcomp&lang=ghc&id=2
.

Let the arguing begin?

Louis Wasserman
wasserman.louis at gmail.com
http://profiles.google.com/wasserman.louis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100601/5a8cf324/attachment.html


More information about the Haskell-Cafe mailing list