← Back to context

Comment by epgui

2 days ago

Haskell tends to be C-fast.

That's not what I see reported, they say Haskell tends to have bad memory layout generally and takes a 5x or so hit to performance.

  • Depends what you're doing, but it really can have C-comparable speed. [0]

    Unoptimised/naive Haskell might be that slow. But that's true of a lot of languages and isn't particularly interesting to me. Java is slow if you do everything the naive way, too.

    [0] https://entropicthoughts.com/on-competing-with-c-using-haske...

    • Java ain't slow even if you do really stupid stuff. Hell, I would even argue that java is the most resistant to stupid code. Some way over-abstracted everything linked data structure will be faster in java than it is in C.

      1 reply →

  • The phrase “tends to” is doing a lot of work here. Inexperienced Haskellers tend to use the singly linked list for everything and that data structure just doesn’t perform in any language.

In many cases it's possible to write Haskell that runs as fast as a given C implementation. However the result will usually not be idiomatic Haskell.