The Computer Language
24.06 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.99 19,700 199    
  C clang 43.96 19,700 199    
  Go 44.00 20,372 212    
  C# .NET 44.08 31,388 210    
  C gcc 44.08 19,724 199    
  Java 44.21 41,428 206    
  Java #2 81.82 41,340 207    
  PHP 8 min 19,664 150    
  Ruby yjit 14 min 21,120 131    
  Python 3 #3 28 min 19,660 150    
  Python 3 55 min 19,660 139    
  Matz's Ruby 1h 37 min 19,860 131    

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