Hacker News new | ask | show | jobs
by pyrale 2922 days ago
> Haskell execution tome is slower than many languages, but is probably comparable with Erlang and Scala.

Do you have specifics on that matter ?

1 comments

There are various multi-language benchmarks, e.g. https://benchmarksgame-team.pages.debian.net/benchmarksgame/
Those benchmarks do not compare like-for-like. Often the Haskell versions try to solve the problems elegantly with high-level functional code at the expense of performance, e.g. see Mandelbrot.

GHC Haskell is an advanced optimising compiler that will produce considerably faster functional code than both Erlang and Java. For maximum performance, it is perfectly possible to write imperative array-oriented code in Haskell, in which case performance should be comparable to Java.

> GHC Haskell is…

Please consider all the things Phil Trinder likely knows about GHC ;-)

https://scholar.google.co.uk/citations?user=3Bs_EA0AAAAJ

My post was more for the benefit of other readers, who might have otherwise concluded that modern GHC is "slow". There are many ways to compare the 'execution time' of e.g. Java and Haskell. Idiomatic Haskell code may well be slower than (traditional) idiomatic Java code. But these days more and more functional code is written in Java/Scala/Clojure and the JVM does not optimise such code nearly as well as GHC.
> Idiomatic Haskell code may well be slower…

So it's a good thing that those "benchmarks do not compare like-for-like" because that allows the inclusion of idiomatic Haskell code?

I can certainly see merit in that idea. The problem is that it's often not clear what the idiomatic style for a particular language applied to a particular problem is. Many of the Haskell solutions also look quite old, predating for example the now standard Haskell "Vector" library.

It's a useful resource, but I think we should we wary of making very general remarks based on the results.