bearophile wrote:
Walter Bright:
* Not all functional programming languages do concurrency well. Haskell and
OCaml in particular have severe fundamental problems with it such that
parallelizing your code makes it slower.<
What kind of problems have you seen in Haskell? I have read several articles
about parallel code written in Haskell, and its situation doesn't look so
bad.
It wasn't me, it was Russell Wider. He wrote a parallel pi calculating program
in several languages, and then tried it with 1, 2, 4, and 8 cores. The more
cores, the longer the Haskell program took. Charting the core use showed that
only one core would run at a time.
Same with OCaml.
OCaml has a global interpreter lock which explains its behavior. Russell didn't
know why the Haskell behavior was so bad. He allowed that it was possible he was
misusing it.
Erlang and Clojure parallelize well, in that performance scales up
proportionally as cores are added.<
There is no way for this to be true in general. "Scalability" is a lot a
characteristic of the algorithm (and the way its subparts exchange data), not
the language. And if you care of performance Erlang is not the best:
http://proliferationofniches.blogspot.com/2008/07/multi-core-problem.html
Erlang is good for other things, like reliability.
With Erlang and Clojure and the parallel pi programming, doubling the number of
cores doubled the speed. Graphing the core use showed they were utilizing the
cores simultaneously.
Erlang was slow in general, but it *did* scale well with the number of cores.