[Haskell-cafe] Speed comparison?

David Roundy droundy at abridgegame.org
Tue May 3 14:06:09 EDT 2005


On Tue, May 03, 2005 at 12:20:45PM -0400, Daniel Carrera wrote:
> Would that be correct? For computational work (e.g. a simulation, 
> factoring primes, whatever) does it approach C speed?
> 
> I would be happy to hear a comparison with any other language you find 
> interesting.:-) As well as any other information you'd like to share.

I wouldn't consider haskell for a serious numerical problem, although I
wish I could.  Of course, I wouldn't consider python or ruby, either,
except as a wrapper around C or C++.  But then, I come from a community
where one occasionally has to justify the decision to not use fortran...

It's possible to write fast code in haskell, but it's very easy to
accidentally write slow code.  In C you don't have to try to guess what the
compiler's going to do, except with regard to inlining functions and loop
optimizations, both of which involve fine-tuning performance at a level way
beyond what C can handle.

An interesting challenge would be to rewrite fftw in haskell, and see how
close one could come to the performance of the original... :) One ought to
be able to write self-tuning code like that a lot more cleanly in haskell,
but the question is whether you could overcome the GC and lazy evaluation
issues to get fast code.  (For the level of tuning needed, consider that
the fftw folks are careful to avoid the use of negative constants, and
thereby achieve a significant improvement in performance.)
-- 
David Roundy


More information about the Haskell-Cafe mailing list