The Computer Language
25.02 Benchmarks Game

more similar


When programs are idiomatic someone will say they are not comparable.

Are they similar-enough to be comparable for your purposes? Will someone then say the programs are not idiomatic.

If only more-idiomatic was not less-comparable!


Here are a few naive un-optimised single-thread #8 programs transliterated line-by-line literal style into different programming languages from the same original.

    Mean or 95% CI in-significant io
× source cpu secs  
1.0 Swift 34.68—34.78 fannkuch-redux
1.0 C gcc 5.54 n-body
1.0 Intel C 2.68 spectral-norm
1.0 C clang 5.56—6.19 n-body
1.0 C clang 36.44—36.51 fannkuch-redux
1.1 Intel C 6.06—6.10 n-body
1.1 C gcc 39.52—40.22 fannkuch-redux
1.2 Swift 6.66 n-body
1.2 Intel C 42.88—43.00 fannkuch-redux
1.3 C# naot 7.01 n-body
1.3 C# naot 44.63 fannkuch-redux
1.3 Java naot 7.29—7.33 n-body
1.3 Go 46.26—46.33 fannkuch-redux
1.3 Java 49.88—55.68 fannkuch-redux
1.4 Dart aot 7.50 n-body
1.4 Java 7.66 n-body
1.5 Java naot 51.94—51.98 fannkuch-redux
1.7 Node.js 58.18 fannkuch-redux
1.7 Go 9.64 n-body
1.7 Node.js 9.66—9.77 n-body
2.0 C# naot 5.34 spectral-norm
2.0 Java naot 5.35 spectral-norm
2.0 Swift 5.35 spectral-norm
2.0 Go 5.36 spectral-norm
2.0 Dart aot 69.18—72.63 fannkuch-redux
2.0 C gcc 5.41 spectral-norm
2.0 C clang 5.42 spectral-norm
2.1 Java 5.51 spectral-norm
2.4 Node.js 6.53—6.67 spectral-norm
4.1 Dart aot 10.89—10.93 spectral-norm
20 Java -Xint 709.01 fannkuch-redux
24 PHP 849.92—863.13 fannkuch-redux
29 Java -Xint 161.04—161.34 n-body
32 Java -Xint 84.24—84.42 spectral-norm
44 PHP 242.50—244.36 n-body
51 PHP 136.38—136.78 spectral-norm
58 Ruby 318.33 n-body
59 Ruby 2,058.52 fannkuch-redux
66 Ruby 175.87—176.32 spectral-norm
71 Python 3 2,455.59 fannkuch-redux
95 Python 3 528.16 n-body
144 Python 3 385.07 spectral-norm

Seemingly similar programs behave differently when the language implementations behave differently. Do they have the same default stdio buffering? Do the programs need to be written differently and run differently to make them behave the same.


To be less similar so they are more comparable!

    Mean or 95% CI significant io
× source cpu secs  
1.0 C# naot 6.30 fasta
1.0 Intel C 23.98 mandelbrot
1.0 Go 62.37—62.83 k-nucleotide
1.0 C gcc 25.18 mandelbrot
1.1 C clang 25.52 mandelbrot
1.1 C# naot 25.55—25.66 mandelbrot
1.1 Swift 25.62 mandelbrot
1.1 Go 26.77 mandelbrot
1.2 Java 27.85—27.91 mandelbrot
1.2 Java naot 28.53—28.69 mandelbrot
1.2 C# naot 75.78—77.28 k-nucleotide
1.2 Intel C 7.90—7.98 fasta
1.3 PHP 80.05—80.48 k-nucleotide
1.3 C clang 8.14—8.25 fasta
1.3 C gcc 8.31—8.37 fasta
1.3 Java 83.79—87.16 k-nucleotide
1.4 Java naot 87.80—89.42 k-nucleotide
1.7 Java naot 10.48—10.54 fasta
1.7 Java 10.94—11.09 fasta
1.7 Node.js 109.38—113.28 k-nucleotide
1.8 Go 11.54—11.80 fasta
2.7 Swift 175.66—188.61 k-nucleotide
2.9 Node.js 71.43—72.95 mandelbrot
3.0 Swift 18.86—18.92 fasta
3.1 Node.js 19.41—19.52 fasta
3.8 Python 3 235.36—236.89 k-nucleotide
6.1 Dart aot 38.41—39.07 fasta
7.5 Dart aot 183.36—187.28 mandelbrot
7.9 PHP 49.85—49.96 fasta
8.3 Ruby 517.57 k-nucleotide
9.2 Dart aot 568.36 k-nucleotide
18 PHP 422.73 mandelbrot
24 Python 3 153.78—158.43 fasta
26 Java -Xint 632.13 mandelbrot
30 Ruby 188.50—189.24 fasta
39 Ruby 943.02 mandelbrot
52 Java -Xint 327.85 fasta
66 Python 3 1,575.80 mandelbrot
Such comparisons raise a nest of issues all their own: for example, is it really the same program when written in the two compared languages? (Will Partain, 1992.)

 

Throw the ratios together and give them a shake!

cpu secs / fastest Geometric Mean
1.1 Intel C    
1.2 C clang    
1.3 C gcc    
1.3 C# naot    
1.5 Go    
1.5 Java    
1.5 Java naot    
1.7 Swift    
2.2 Node.js    
4.1 Dart aot    
15 PHP    
30 Java -Xint    
36 Ruby    
42 Python 3