The Computer Language
24.04 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.49 19,736 433    
  C gcc #2 24.96 19,520 412    
  C gcc 26.23 19,520 433    
  Go #2 26.63 19,696 500    
  Go 27.63 19,696 469    
  Java 29.62 43,712 445    
  C# .NET 46.68 31,464 472    
  PHP #3 161.27 19,396 418    
  PHP #2 191.25 19,396 397    
  PHP 201.46 19,396 390    
  Java -Xint 8 min 34,972 445    
  Ruby #2 19 min 21,504 313    
  Ruby 20 min 21,248 341    
  Python 3 #3 22 min 19,656 392    
  Toit 26 min 19,644 387    
  Python 3 #2 30 min 19,656 337    
  Python 3 1h 11 min 19,656 380    
  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?