The Computer Language
24.09 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.62 20,580 433    
  C gcc #2 25.04 19,708 412    
  C gcc 26.30 19,708 433    
  Go #2 26.67 19,808 500    
  C# .NET 27.23 32,036 493    
  Go 27.30 19,808 469    
  Java 29.28 43,792 445    
  PHP #3 127.57 19,804 418    
  PHP #2 156.45 19,804 397    
  PHP 167.49 19,804 390    
  Java -Xint 8 min 35,168 445    
  Ruby yjit #2 19 min 21,248 313    
  Ruby yjit 20 min 20,992 341    
  Python 3 #3 20 min 19,660 392    
  Toit 28 min 68,992 387    
  Python 3 #2 28 min 19,660 337    
  Python 3 56 min 19,660 380    
  Matz's Ruby 2h 39 min 19,680 341    
  Matz's Ruby #2 3h 06 min 19,860 313    

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?