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%
3.2Cython 25.5425.568,7121315  100% 1% 0% 0%
3.3Cython 25.6225.648,8841315  84% 17% 1% 1%
3.3Cython 25.6525.658,8401315  1% 0% 0% 100%
7.1Nuitka 56.0556.0510,2041315  68% 1% 33% 1%
7.2Nuitka 56.5056.5010,2561315  54% 2% 48% 2%
7.3Nuitka 57.7457.7410,3201315  1% 44% 57% 1%
7.8Python 3 61.0861.088,8721315  0% 0% 0% 100%
7.8Python 3 61.1061.108,8041315  100% 0% 0% 0%
7.9Python 3 62.4362.438,8041315  0% 0% 0% 100%
8.3IronPython 66.4165.4262,6201337  29% 14% 58% 0%
8.4IronPython 66.8066.1264,4761337  7% 35% 23% 36%
8.4IronPython 67.0766.4962,8321337  36% 25% 32% 9%
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%
10Python development version 79.7881.527,6121315  41% 22% 41% 59%
11Jython 94.6088.48281,0001337  30% 37% 32% 28%
11Jython 97.6290.33281,9121337  36% 30% 33% 26%
13Jython 108.81102.02281,1401337  31% 26% 30% 34%
16MicroPython 129.28129.284,3761315  3% 99% 1% 3%
missing benchmark programs
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