The Computer Language
24.09 Benchmarks Game

too simple

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 process mem in-process    
  Intel C 21.98 19,436 21.980
  C clang 43.97 19,436 43.968
  Go 44.01 19,436 44.012
  C# .NET 44.12 26,520 44.070
  Java 44.20 42,012 44.151
  C gcc 44.43 19,436 44.424
  Java -Xint 5 min 37,792 323.444
  PHP 8 min 19,436 508.680
  Ruby yjit 14 min 20,992 854.598
  Python 3 #3 29 min 19,316 1,744.378
  Python 3 54 min 19,316 3,245.662
  Matz's Ruby 1h 38 min 19,440 5,895.362

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

The "process" measurements (the usual elapsed-seconds) were made without doing warm-up iterations and include startup costs.

The "in-process" measurements were made without doing warm-up iterations and exclude startup costs.