The Computer Language
23.03 Benchmarks Game

Measure Which programming language is fastest?


My question is if anyone here has any experience with simplistic benchmarking and could tell me which things to test for in order to get a simple idea of each language's general performance?

There's more than one right answer.

For some programs —


Benchmark program CPU seconds compared to the fastest for selected programming language implementations.

For some simple programs —


The current Ruby mandelbrot multicore programs are 7x faster than this simple Ruby transliteration and the exhaustively-optimised + multicore + vector-instruction C programs are more-like 25x faster than this simple C program.

  source code secs mem gz    
  Intel C 23.34 11,052 427    
  C gcc #2 25.22 11,112 406    
  C gcc 26.27 11,112 427    
  Go #2 26.53 11,112 494    
  Go 27.22 11,112 462    
  Java 29.53 41,244 439    
  C# .NET 47.52 30,452 465    
  PHP #2 143.01 12,992 391    
  PHP #3 163.38 13,004 412    
  PHP 204.22 12,976 384    
  Ruby #2 19 min 25,596 307    
  Ruby 20 min 25,492 335    
  Python 3 #3 23 min 11,064 384    
  Python 3 #2 30 min 11,192 330    
  Python 3 1h 03 min 11,032 373    
  Matz's Ruby 2h 35 min 11,052 335    
  Matz's Ruby #2 3h 13 min 11,056 307    

Transliterations are not necessarily idiomatic. When the Ruby #2 and Python #2 programs are most idiomatic they are furthest from identical — are they similar-enough to be comparable for your purposes? (The Python #2 program uses a built-in complex-number type.)

The slightly-moderately-highly-wildly("I spent two weekends on this") optimised mandelbrot programs are not identical — does that matter for your purposes? And [pdf] As fast as C or As fast as SSE and AVX?


For more language implementations —


Answers & Questions, Criticism & Response —