[Haskell-cafe] Re[2]: What's the deal with Clean?

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Nov 5 06:25:03 EST 2009

Hello John,

Thursday, November 5, 2009, 1:59:14 PM, you wrote:

> I hope you don't mind me asking this, but when you state that
> "idiomatic haskell is much slower than idiomatic C", what do you mean
> by "much slower"?  2 times?  3 times?  20 times?  Order of magnitude?

it depends on task, of course. with a number crunching code, it may be
hundreds or even thousands, but this application area isn't typical
for haskell, after all. for typical apps like text processing it may
be dozens. when we are going into real life, use of FFI libraries and
OS calls makes difference even smaller, so i think that practical
difference is 3-10 times, in most cases

> I'm not going to disagree with you, however it seems to me the gap is
> closing.

except for BS library, i don't see too much practical improvements.
GHC by itself was made ~20% faster with pointer tagging

> My opinion may be colored by having just examined Masayuki
> Takagi's SPH code, which I considered very idiomatic Haskell and for
> me performed equivalently to his C++ code with the changes I detailed
> in an earlier email (none of which involved any substantial changes to
> his code or style in my opinion).

i don't know why his haskell code is so fast - it may be due to
improvements in ghc about compiling tight loops, unoptimal C code,
bounds placed by memory speed. well, i know one problem in his C
compilation - he doesn't used -O3 -fexcess-precision and other funny
optimization tricks

there is difference in treating good and bad comparisons. when someone
shows that haskell is much slower, there are lot of suggestions how to
improve the code, add strictness, use other libs, apply tricky
compiling options, even unroll loops by hand. when someone shows small
gap between C and Haskell, noone checks that C code is optimized as
much as possible. of course, it's mainly because many haskellers can't
optimize C code. but this should lead to the conclusion "i'm
incompetent in comparison" rather than "haskell is fast"

> Best,
> John

>> From: Bulat Ziganshin <bulat.ziganshin at gmail.com>
>> i don't say that haskell is slow for real programs. i say that
>> idiomatic haskell is much slower than idiomatic C and these papers
>> demonstrates how much, for simple computation-intensive loops
>> --
>> Best regards,
>>  Bulat                            mailto:Bulat.Ziganshin at gmail.com

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list