The Computer Language
24.11 Benchmarks Game

more-similar less-idiosyncratic


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 lowest-common-denominator style into different programming languages from the same original —

elapsed secs / fastest insignificant io
 
× source  
1.0 Intel C spectral-norm
1.0 Swift fannkuch-redux
1.0 C gcc n-body
1.0 C clang n-body
1.0 C clang fannkuch-redux
1.1 Intel C n-body
1.1 C gcc fannkuch-redux
1.2 Swift n-body
1.2 Intel C fannkuch-redux
1.3 C# aot n-body
1.3 C# aot fannkuch-redux
1.3 Java fannkuch-redux
1.3 Go fannkuch-redux
1.4 Dart n-body
1.4 Java n-body
1.7 Node.js fannkuch-redux
1.7 Node.js n-body
1.7 Go n-body
2.0 C# aot spectral-norm
2.0 Swift spectral-norm
2.0 Go spectral-norm
2.0 Dart fannkuch-redux
2.0 C gcc spectral-norm
2.0 C clang spectral-norm
2.0 Java spectral-norm
2.4 Node.js spectral-norm
4.1 Dart spectral-norm
20 Java -Xint fannkuch-redux
29 Java -Xint n-body
30 Java -Xint spectral-norm
44 PHP n-body
49 PHP fannkuch-redux
51 PHP spectral-norm
56 Ruby yjit fannkuch-redux
63 Ruby yjit spectral-norm
64 Python 3 fannkuch-redux
70 Ruby yjit n-body
94 Python 3 n-body
142 Python 3 spectral-norm
586 Matz's Ruby n-body
626 Matz's Ruby 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!

elapsed secs / fastest significant io
 
× source  
1.0 Intel C mandelbrot
1.0 C# aot fasta
1.0 Go k-nucleotide
1.0 C gcc mandelbrot
1.1 C clang mandelbrot
1.1 C# aot mandelbrot
1.1 Swift mandelbrot
1.1 Go mandelbrot
1.2 Java mandelbrot
1.2 C# aot k-nucleotide
1.2 Intel C fasta
1.3 PHP k-nucleotide
1.3 C clang fasta
1.3 C gcc fasta
1.3 Java k-nucleotide
1.6 Java fasta
1.8 Go fasta
2.3 Node.js k-nucleotide
2.9 Swift k-nucleotide
3.0 Node.js fasta
3.0 Node.js mandelbrot
3.0 Swift fasta
3.9 Python 3 k-nucleotide
5.8 Dart fasta
7.9 PHP fasta
8.4 Dart mandelbrot
9.0 Dart k-nucleotide
13 Ruby yjit k-nucleotide
18 PHP mandelbrot
25 Python 3 fasta
26 Java -Xint mandelbrot
30 Ruby yjit fasta
53 Java -Xint fasta
63 Ruby yjit mandelbrot
64 Python 3 mandelbrot
126 Matz's Ruby fasta
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.)
elapsed secs / fastest Geometric Mean
1.1 Intel C  
1.2 C clang  
1.3 C gcc  
1.3 C# aot  
1.4 Java  
1.4 Go  
1.7 Swift  
2.3 Node.js  
4.1 Dart  
16 PHP  
30 Java -Xint  
42 Python 3  
43 Ruby yjit  
359 Matz's Ruby