The Computer Language
24.04 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.95 19,736 199    
  C clang 43.90 19,684 199    
  Go 43.94 19,696 212    
  C# .NET 44.00 31,044 210    
  Java 44.14 41,376 206    
  C gcc 45.46 19,520 199    
  Java #2 81.68 41,512 207    
  PHP 8 min 19,396 150    
  Ruby 14 min 21,120 131    
  Python 3 #3 28 min 19,656 150    
  Python 3 1h 01 min 19,656 139    
  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.