The Computer Language
23.03 Benchmarks Game

too simple

Swap two statements and see the Java code slow down. Swap globals for local variables in a function and see the Python code speed up. Swap language implementations and see the C code speed up.

Take a tiny tiny ten-line snippet of code, loop through 10 000 million times and usually brittle performance measurements may become micro-benchmark-broken.

  source secs mem gz    
  Intel C 21.94 11,136 193    
  Classic C 43.89 11,136 193    
  C clang 43.89 11,136 193    
  Go 43.90 11,136 206    
  C# .NET 44.07 30,532 204    
  Java 44.15 40,784 200    
  C gcc 45.44 11,136 193    
  Java #2 81.72 40,820 201    
  PHP 8 min 12,772 144    
  Ruby 12 min 25,496 125    
  Python 3 #3 31 min 11,028 143    
  Python 3 56 min 11,032 133    
  Matz's Ruby 1h 36 min 11,116 125    

Something to think about, when you're tempted to draw broad conclusions from ten-line snippets of code.