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 fasta
1.0 Intel C mandelbrot
1.0 C# aot k-nucleotide
1.0 C gcc mandelbrot
1.1 C clang mandelbrot
1.1 C# aot mandelbrot
1.1 Swift mandelbrot
1.1 Java k-nucleotide
1.1 PHP k-nucleotide
1.1 C clang fasta
1.1 C gcc fasta
1.1 Go mandelbrot
1.2 Java mandelbrot
1.5 C# aot fasta
2.4 Java fasta
2.5 Swift k-nucleotide
2.7 Go fasta
3.0 Node.js mandelbrot
3.3 Python 3 k-nucleotide
4.4 Node.js fasta
4.5 Swift fasta
7.6 Dart k-nucleotide
8.4 Dart mandelbrot
8.6 Dart fasta
11 Ruby yjit k-nucleotide
12 PHP fasta
18 PHP mandelbrot
26 Java -Xint mandelbrot
37 Python 3 fasta
45 Ruby yjit fasta
63 Ruby yjit mandelbrot
64 Python 3 mandelbrot
78 Java -Xint fasta
187 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.2 C gcc  
1.3 C# aot  
1.5 Java  
1.7 Go  
1.7 Swift  
2.5 Node.js  
4.3 Dart  
17 PHP  
32 Java -Xint  
43 Python 3  
44 Ruby yjit  
410 Matz's Ruby