The Computer Language Shootout

Ulf Wiger (AL/EAB) <>
Fri Mar 17 10:57:41 CET 2006


One obvious first optimization would be to
not use string:str(Line, ">THREE Homo sapiens frequency"),
but rather to check whether the line actually starts
with ">THREE", thus:

seek_three() ->
    case io:get_line('') of
       ">THREE" ++ _ -> found;
       eof -> erlang:error(eof);
       _ -> seek_three()
    end.

This tiny change alone gives a 18% speedup
on my machine.

Regards,
Ulf W

> -----Original Message-----
> From:  
> [mailto:] On Behalf Of 
> Kenneth Johansson
> Sent: den 17 mars 2006 04:23
> To: 
> Subject: The Computer Language Shootout
> 
> http://shootout.alioth.debian.org/gp4/benchmark.php?test=knucl
> eotide&lang=all
> 
> I did an implementation in erlang for the knucleotide.  
> 
> And while the code is much shorter than C and fortran it's 
> larger than ruby and python. But since this is my first real 
> try at erlang I'm sure someone here can do significant improvement.
> 
> Also the speed is a problem it's on my computer 8 times 
> slower than the python version.
> 
> 



More information about the erlang-questions mailing list