In 2011, Robert Hundt published this paper testing the performance of several languages on a loop detection task typically found in compilers. The code is available here. Go had to tweaked a bit. I ran the benchmarks on EC2 m3.medium instance with Ubuntu 14.04 (ami-1d8c9574). For some benchmarks there’s a Pro version where someone hand optimized the code. Here are the results:
Language | Runtime(sec) |
C++ | 48 |
Java | 93 |
Java Pro | 40 |
Scala | 74 |
Scala Pro | 28 |
Go | 92 |
Go Pro | 63 |
Python | 891 |
PyPy | 138 |
The following lessons can be learned: PyPy is awesome. Java, Scala, and Go are in the same league. Finding an expert to optimize your hotspots might double performance.
Versions:
- g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
- java version “1.8.0_05″
- go version go1.3 linux/amd64
- Python 2.7.6
- Python 2.7.6 (2.3.1+dfsg-1~ppa1, Jun 20 2014, 09:27:47) [PyPy 2.3.1 with GCC 4.6.3]
- Scala code runner version 2.11.1 — Copyright 2002-2013, LAMP/EPFL
