35

Many functional language advocates make a few surprising assertions about them:

  • functional languages code is significantly less buggy than otherwise
  • functional languages code is significantly faster than otherwise in parallel scenarios
  • functional languages code is significantly cheaper to write than otherwise

I am only able to find a lot of speculation on the matter but I can't find hard data. Has anyone actually measured it?

I'd only like to see answers citing peer-reviewed material from reputable sources, such as IEEE or ACM. I am not interested in any logical or theoretical explanation, but only in rigorous measurements on real world projects/code bases.

  • 3
    Why not link to one of Paul Graham's essays for notability? – dmckee Apr 14 '14 at 1:04
  • 3
    I think the "faster" argument might need to be clarified a bit, the way I have heard this only refers to functional programming being easier to run in parallel on many cores, not that they are intrinsically faster. – Mad Scientist Apr 14 '14 at 5:52
  • 1
    "significantly faster than otherwise in parallel scenarios" is that really a claim? Doesn't make much sense, OTOH claim "significantly faster to develop than otherwise in parallel scenarios" could have some merit. – vartec Apr 14 '14 at 13:06
  • 2
    "I'd only like to see answers citing peer-reviewed material from reputable sources, such as IEEE or ACM." Nice requirement, however I don't think you'd get any relevant answers. First of all research lags behind marked by many years. Moreover I have impression that current fast moving companies aren't really interested in 80s style mega-corporation "productivity metrics", so I wouldn't expect much effort going to real life study of the question. – vartec Apr 14 '14 at 13:20
  • 2
    @Sklivvz: that part is marked with DemandForEvidence, logically you cannot really have a high-level language implemented in C (or C++ for that matter), be faster than C. It all comes down to practicality of doing low-level programming if you can implement it with enough speed (and ease) in higher level language. – vartec Apr 14 '14 at 13:37
13

Pankratius, Schmidt, and Gareton, 2011 found:

Contrary to popular belief, the functional style does not lead to bad performance. Average Scala run-times are comparable to Java, lowest run-times are sometimes better, but Java scales better on parallel hardware. We confirm with statistical significance Scala’s claim that Scala code is more compact than Java code, but clearly refute other claims of Scala on lower programming effort and lower debugging effort.

As always with empirical studies of software development, one must be very cautious about generalizing. In the particular case of a study about Scala done in ~2010, one would certainly worry about:

  • language familiarity (Scala being far less popular than Java)
  • tool support (a problem that's still significant, but was acute in 2010)
  • use of immutable data structures

(Update: It's not clear to me that this study was ever peer-reviewed.)

-3

You might want to look at http://haskell.cs.yale.edu/wp-content/uploads/2011/03/HaskellVsAda-NSWC.pdf, "Haskell vs. Ada vs. C++ vs. Awk vs. ...: An Experiment in Software Prototyping Productivity".

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 5
    Please quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. – Kreiri Apr 14 '14 at 10:57
  • 4
    I am downvoting this because it doesn't seem to be a real world study, but a simple subjective experiment, which is not what I asked for. There's a big difference in cost/time etc. when you have to factor in costs of maintenance and effectiveness of the software, and this article seems to be only covering a special case. – Sklivvz Apr 14 '14 at 11:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .