The Computer Language
23.03 Benchmarks Game

simple

First a few simple programs.

Half are naive line-by-line transliterations from the original C program; others are old initial 2004 and 2005 programs from the archives. 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 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 obviously not idiomatic — does that matter for your purposes? When the archive 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 archive Python #2 program uses a built-in complex-number type.)

Differences in approach — to memory management, parallel programming, regex, arbitrary precision arithmetic, implementation technique — are part and parcel of using different programming languages.

The optimised mandelbrot programs are far from identical — does that matter for your purposes?

Then — As fast as C?

Now — As fast as SSE and AVX instructions?