[Haskell-cafe] Can Haskell outperform C++?

Jerzy Karczmarczuk jerzy.karczmarczuk at unicaen.fr
Sun May 6 12:09:39 CEST 2012


Roman Cheplyaka:
> If you're saying that in C an explicit stack should have been used
> instead of recursion, then it would increase the code complexity while
> having non-obvious performance benefits.
This is a fragment of a bigger message I won't comment.

But THIS is a little dubious. You may accuse anything of anything by 
such vacuous statements as "non-obvious performance benefits". If the 
stack frame allocation policy is lousy (not because of incompetence of 
the compiler writers, but because of its "universalism"), then the gain 
may be quite visible. My favourite examples are the classical "flood 
fill" algorithms for filling closed regions in computer graphics, and 
also some models of percolation (finding paths in rather big graphs). 
Everything depends on the language used, but I have seen  the 
acceleration by a factor of 5 after having replaced the recursion by 
explicit stacks + loops.

Jerzy Karczmarczuk





More information about the Haskell-Cafe mailing list