Roman Cheplyaka <r...@ro-che.info> wrote:

> >  isn't it that particular Haskell code is outperforming C (22
> > seconds vs. 33), just because the author uses recursion in C? I
> > surely love Haskell, and the way it's code is easy parallelized, but
> > that example seams not fair.
>
> I think the point was to take two programs of similar code complexity
> (or, rather, simplicity) implementing the same algorithm (modulo
> parallelism).
>
> So I'm not sure what exactly you're objecting to.

I think while this is a valid argument it is not very convincing.  You
have to acknowledge that C and C++ can give better performance at number
crunching.  The gain is small enough that personally I wouldn't go
through the trouble of writing my algorithms in C/C++, but simple-minded
people often have a desire to get the best performance possible, in
which case you really want to use C, C++, Fortran or whatever high level
assembler language you like.

In other words:  Writing Haskell in C is just as wrong as writing C in
Haskell.  A comparison of algorithm /implementation styles/ does not
have much semantic content.  It just shows that Haskell rocks at high
level optimization while C rocks at low level optimization.  By the same
experiment you can see that Haskell is bad at low level optimization
while C is bad at high level optimization.

In order to compare code performance you have to implement the same
algorithm in the idiomatic style in both languages.  This experiment
would show that Haskell, even though it gets close, is still slower than
C.  It would however show that interpreted Python and Ruby are
considerably slower than both.


Greets,
Ertugrul

-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to