[Haskell] Programming language shootout (completing the Haskell
ahey at iee.org
Sat Mar 27 00:18:46 EST 2004
On Friday 26 Mar 2004 10:39 pm, Sean E. Russell wrote:
> Why is Ocaml so darned fast compared to Haskell?
My guess is that strictness vs. non-strictness probably has
a lot to do with it. Not that I think non-strictness itself
is a particular problem, but I can't help thinking that a
lazy by default evaluation strategy (easiest way to comply
with non-strict semantics) is always going to be a bit
of a performance killer, especially in typical benchmark
Of course it isn't to hard to come up with examples where
(for given algorithmic elegance) laziness is a big win too.
But in these circumstances users of strict languages would
probably chose a different (uglier) approach from the obvious
Haskell solution, so there's no opportunity for Haskell to
shine here either (in raw performance terms at least).
Also, I have a hunch that not only is eager evaluation inherently
more efficient (in terms of the raw number of operations that need
to be performed), it's probably more cache friendly too (you probably
end up with code that looks far more like a traditional imperative
loops and whatnot that you'll get by performing "itsy bitsy on
demand" graph reduction).
There are other issues to, like pure vs. impure and the use
of packed strings by default (as I believe Ocaml does) vs. lists
of Chars in Haskell.
All this is, of course, pure speculation and intuition on my part.
(I can't produce a shred of evidence to justify these remarks :-)
As someone observed the other day, the figures in the shootout
are rather old and probably don't accurately reflect current Haskell
(I.E. ghc I presume) performance in any case.
BTW, there also seems to be a Win32 clone of the shootout here which may
have more life in it..
More information about the Haskell