Wednesday, 25 May 2016

Latest language benchmarking

This originally started as an attempt to compare functional language performance before embarking on a new project. It was all about immutable, lists, recursion and all those glorious functional programming constructs.

It's a straightforward piece of code, with tight loops and LOTS of floating point calculation. It should benefit JITs well and is small enough to fit in the level 1 CPU cache.

However, it changed into something different, which was a general language performance comparison. This does however suggest that I should revisit the original intention and do a proper functional language comparison using the specific idioms of each. That WOULD be interesting.

I've tidied up the process and fixed some bugs in the code. Without further ado, here is the latest results (all run on my 2012 MacBook Pro in Mac OS X):

Language Real User Sys
Rust 0:12.47 11.94 0.14
C++ 0:12.73 12.05  0.21
Monkey-X 0:15.84 15.17 0.24
PyPy2 0:16.76 16.11 0.20
Go 0:23.41 23.19 0.17
BlitzMax 0:24.87 23.99 0.24
C# 0:27.87 26.50 0.60
Java 0:30.41 30.43 0.25
Scala 0:31.63 31.25 0.66
D 0:32.22 31.98 0.15
PyPy3 0:32.44 31.34 0.34
Haskell 0:38.96 38.27 0.50
O'Caml 0:43.50 43.19 0.20
F# Mono 0:58.05 57.32 0.52
Clojure 1:01.01 62.52 1.01
C# Mono 1:01.38 58.84 0.83
Ruby 2:31.46 149.54 0.54
Python2 4:46.03 282.67 1.43
Python3 4:26.41 264.80 0.72


Very interesting results. Rust is the quickest, with PyPy2 showing a very impressive performance.

The source code is at https://github.com/zolbatar/functional-comparison.