I makes very little sense to compare GCC (C++) with GHC (Haskell) inspite of the
sneaky names.

1) While no C++ expert, I'd conjecture that compiling C++ is roughly five times
harder than C, due to C++ being a much larger language with _many many_ ugly
corners.  The difficulty in compiling Haskell is not exactly comparable, as the
language it much more advanced, but also far more streamlined.  Haskell however, has
also grown to be a fairly large language.

2) Whereas for the speed of compilers there's little in C++ that should slow down a
_non_ optimizing compiler (well...).  C++ evolved from C and C++ compilers evolved
from C compilers.  C was designed such that you could compilable it on the machines
available at the time (that is, less than 64k).  Haskell, however, was designed in
modern time and require much more work of the compiler (even a _non_ optimizing
compiler) in order to save the work of the programmer.

As a consequence of the language there is less room and need for optimization when
compiling C++, and the optimization rarely improves the result in a spectacular way.
With Haskell, the situation is quite different.  There can be a world of difference
between the performance of a naive Haskell compiler and a sophisticated one and there
is likely to be a correlation with the compile time.

3) Compiling C and C++ is relatively well understood and GCC is a production level
compiler.  Compiling Haskell is still the basis of active (? :-) research and GHC is
a research project.

Frank A. Christoph wrote:
> .... The number of times GHC has been too slow and
> memory-hungry for me indicates that Haskell is not suitable for writing
> anything as general-purpose as a compiler.

That's a fairly naive remark.  I could write you a really slow and fat C++ compiler i
C if you like. There are a number of reasons why it's too early judge.  For a
stunning example, you should look at Niklas Rojemo's thesis about NHC.  Now there's a
space-tight compiler (although slow).

Having said all that, yes, predictable memory behavior is IMHO the biggest problem of
lazy language implementation these days.

Juergen Pfitzenmaier wrote:

> Maybe it is because GHC is doing some things that are difficult ;) Oh I know
> a C++ compiler is handling complicated things (but only because the design of
> C++ is brain damaged). Haskell is well designed (not neccessarily in every
> detail but more as a whole) and has some features that need memory to compile.
> I know of C++ programms with ca. 10.000 lines that take about 20 (twenty !!)
> minutes to compile with egcs 1.1 on a 300Mhz pentium II. So there does GHC stand ?

To make even the slightest useful statements based on these opservations we would
have to know much more, at the very least, the level of optimization used.

</rant>

/Tommy


Reply via email to