Functional Programming Battle

2012 10 03 09 09 21

I’ve been spending some quality time with Scala lately and ran into this research paper comparing Scala, Haskell and F# titled Haskell vs. F# vs. Scala: A High-level Language Features and Parallelism Support Comparison.  It’s a great read and well-worth the time.

This paper provides a performance and programmability comparison of high-level parallel programming support in Haskell, F# and Scala. Developing several parallel versions, we employ skeleton-based, semi-explicit and explicit approaches to parallelism. We focus on advanced language features for separating computational and coordination aspects of the code and tuning performance. We also assess the impact of functional purity and multi-paradigm design of the languages on program development and performance.

It’s interesting to see the three languages compared for their abilities in parallel applications.  It should be noted that the paper is from the Glasgow Parallel Haskell web site so there may be some bias but nothing outstanding.

I like the fact that the comparison is based on a Java VM language, Scala, a .NET language, F#, and a native language of Haskell.  Running on a rich runtime such as the JVM or .NET gives the developer a library of which to draw from, it also adds some overhead.  The results are pretty much what I expected with Scala doing better than I would have envisioned.  The JVM seems to be well-tuned. 

You can download a PDF version of the paper here.   The code used in the benchmarks are also available.

  • Stefan

    Could it be that they used the client hotspot JVM on windows? Sentences like “The Scala version is the slowest one under Windows, but significantly better under Linux.” feed some doubt that it’s a client vs. server benchmark.

  • http://www.accidentaltechnologist.com Rob Bazinet

    It could be. I don’t take cross OS benchmarks to heart. I think the only way to look at this is, how do all 3 languages run on Windows? Then, how do all 3 run on Linux. Never comparing Windows to Linux because it’s not really fair. Most language that are not produced by Microsoft, don’t run particularly well in Windows..there are exceptions but as a general rule.