n-body benchmark N=5,000,000

Each chart bar shows how many times slower, one ↓ n-body program was, compared to the fastest program.

These are not the only programs that could be written. These are not the only compilers and interpreters. These are not the only programming languages.

Column × shows how many times more each program used compared to the benchmark program that used least.

    sort sortsort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0PyPy 2 7.877.8773,5401337  1% 1% 100% 0%
1.0PyPy 2 7.947.9573,7961337  0% 0% 100% 1%
1.0PyPy 2 7.947.9573,6401337  75% 1% 25% 0%
1.0PyPy 3 7.997.9964,4441315  0% 0% 100% 0%
1.0PyPy 3 8.028.0264,6121315  2% 1% 2% 99%
1.0PyPy 3 8.188.1864,6081315  1% 1% 2% 100%
4.2Cython 32.8032.828,3121315  3% 5% 100% 4%
4.2Cython 33.4233.438,1441315  7% 58% 49% 5%
4.3Cython 33.5233.538,2841315  56% 7% 50% 6%
7.0Nuitka 55.0155.0110,4641315  1% 100% 1% 0%
7.1Nuitka 55.8355.8310,4921315  82% 1% 19% 1%
7.2Nuitka 56.3056.3010,3281315  1% 100% 1% 1%
8.8Python 3 69.3369.339,0001315  7% 4% 97% 100%
8.8IronPython 69.6869.5985,7641337  3% 79% 1% 23%
8.9Python 3 70.4270.449,0161315  43% 29% 62% 76%
9.0Python 3 70.6070.628,9561315  18% 44% 87% 60%
9.1Python development version 71.9771.997,7921315  29% 3% 50% 28%
9.2Python 2 72.6572.666,5921337  3% 3% 2% 100%
9.3Python 2 72.9872.996,2441337  25% 3% 77% 2%
9.3Python development version 73.0673.127,6081315  7% 20% 65% 26%
9.6Python 2 75.5275.536,7121337  8% 11% 8% 94%
10IronPython 78.1778.0884,2201337  40% 46% 64% 58%
10IronPython 79.1579.0481,1121337  13% 5% 91% 97%
10Python development version 79.7881.527,6121315  41% 22% 41% 59%
17MicroPython 135.07135.074,2321315  7% 1% 95% 1%
missing benchmark programs
Jython No program
Shedskin No program
Numba No program
Pyston No program
Grumpy No program

 n-body benchmark : Double-precision N-body simulation

ndiff -abserr 1.0e-8 program output N = 1000 with this output file to check your program is correct before contributing.

We are trying to show the performance of various programming language implementations - so we ask that contributed programs not only give the correct result, but also use the same algorithm to calculate that result.

For background information see N-body problem. Useful symplectic integrators are freely available, for example the HNBody Symplectic Integration Package.

Thanks to Mark C. Lewis for this benchmark.

Revised BSD license

  Home   Conclusions   License   Play