The Computer Language
22.05 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    
  C gcc #2 25.31 968 400    
  C gcc 26.42 1,020 418    
  Go #2 26.64 1,608 494    
  Go 27.28 1,140 462    
  Java 40.89 35,696 439    
  C# .NET 45.80 33,708 465    
  PHP #2 185.42 11,728 391    
  PHP 195.57 11,792 384    
  Ruby #2 20 min 285,356 307    
  Ruby 21 min 285,312 335    
  Python 3 #2 34 min 7,132 330    
  Perl #2 43 min 5,188 351    
  Perl 50 min 5,736 375    
  Python 3 1h 09 min 7,736 373    
  Matz's Ruby 2h 12 min 3,908 335    
  Matz's Ruby #2 2h 41 min 3,240 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?