[Haskell-cafe] Haskell Speed

Jeremy Shaw jeremy.shaw at linspireinc.com
Fri Dec 23 15:07:28 EST 2005

At Fri, 23 Dec 2005 19:14:46 +0000,
Daniel Carrera wrote:
> Hi all,
> I'm taking a look at the "Computer Language Shootout Benchmarks".
> http://shootout.alioth.debian.org/
> It looks like Haskell doesn't do very well. It seems to be near the 
> bottom of the pile in most tests. Is this due to the inherent design of 
> Haskell or is it merely the fact that GHC is young and hasn't had as 
> much time to optimize as other compilers?

Rumor has it that the poor results are due to the inherent design of
the shootout itself. The shootout seems to test how fast specific
algorthims can be executed in various languages. Instead of testing:

 "Write a program that solves this problem quickly"

the tests are:

 "Write a program that solves this problem quickly, using *this* algorithm"

And many of the algorithms that you are required to use are a very
poor match for haskell. If the challenge was simply to solve the
problem using any algorithm you wanted, then Haskell would probably
fair much better.

Another possible factor is known deficiencies in current IO library
used by most haskell compilers. It is my understanding that the
current IO library was not implemented with speed and efficiency as a
top priority. If someone took the time to optimize/rewrite the current
library code, it might be possible to greatly increase the overall
speed of IO intensive haskell programs with out any changes to the
compilers or language.

In theory, compiled haskell code ought to be faster than
C. Optimization techniques like "whole program compilation" allow for
optimizations that would not be possible under most
languages. However, many of these techniques are still being
developed, are hard to implement and are not fully
understood. Projects like jhc aim to figure out which of these
techniques actually work in the real world.

Personally, I think one of the main reasons why haskell is 'slow' is
because it is fast enough for most people. Given a choice of 'more
features' or 'more speed', many people prefer 'more features'. That
said, the GHC maintainers manage to do both somehow.

ps. Everything I said in this email may be wrong...

More information about the Haskell-Cafe mailing list