On 1/3/06, Chris Kuklewicz <[EMAIL PROTECTED]> wrote: > Hello, > > Where there were no entries to the > http://shootout.alioth.debian.org/benchmark.php?test=chameneos&lang=all > benchmark, there are now two. The one by Josh Goldfoot is already > posted, the one Einar Karttunen and I optimized has been submitted and > will run faster/smaller. Our code is at > http://haskell.org/hawiki/ChameneosEntry > > Now for improving the fasta benchmark, > http://shootout.alioth.debian.org/benchmark.php?test=fasta&lang=all , > which currently has a space leak in the Haskell entry. > > A non-leaking version which has been optimized to run 3.5 times faster > is now up at http://haskell.org/hawiki/FastaEntra (ooops..my spelling > mistake). > > It could still be made to run about 3 times faster, if the other > languages are any guide. Anyone want to help polish this one? > > Also, two other existing entries have space leaks, as can be seen at > http://shootout.alioth.debian.org/benchmark.php?test=all&lang=ghc&lang2=ghc
I took a stab at the rev-comp one due to boredom. It's not a space leak, believe it or not, it's *by design*... My god, I think someone is consciously trying to sabotage Haskell's reputation! Instead of reading input line-by-line and doing the computation, it reads a whole bunch of lines (hundreds of megs worth, apparently) and only does away with them when a new header appears. Anyway, I uploaded a dead simple "first-naive-implementation" which is significantly faster (and more elegant): complement i = complArr ! i' where i' = toUpper i complArr = array ('A','Z') (self ++ complAssoc) where self = az `zip` az az = ['A'..'Z'] complAssoc = [ ('A','T'),('C','G'),('G','C'),('T','A'),('U','A'),('M','K'),('R','Y'),('W','W'), ('S','S'),('Y','R'),('K','M'),('V','B'),('D','H'),('D','H'),('B','V'),('N','N') ] process header@('>':xs) = putStrLn header process x = putStrLn (map complement x) main = do xs <- getContents mapM process (lines xs) /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe