[Haskell-cafe] OCaml list sees abysmal Language Shootout results

Graham Klyne GK at ninebynine.org
Wed Sep 29 08:41:03 EDT 2004

At 10:55 28/09/04 +0100, Malcolm Wallace wrote:
>Keith Wansbrough <Keith.Wansbrough at cl.cam.ac.uk> writes:
> >           I can't believe that a simple "wc" implementation should be
> > 570 times slower in Haskell than OCaml - could someone investigate and
> > fix the test?
>With code like this, I'm not surprised!
>     main = do file <- getContents
>               putStrLn $ show (length $ lines file) ++ " " ++
>                          show (length $ words file) ++ " " ++
>                          show (length file)
>Space-leak or what?

Er, please excuse a dumb question, but I'm struggling to see the problem here.

I can see that this requires the original file to be kept for 3-time 
scanning,  so enough memory for the entire file will be required.  Is that 
*the* problem to which you allude?  I can't see any other problem 
here.  And why would this put Haskell at a disadvantage?


Graham Klyne
For email:

More information about the Haskell-Cafe mailing list