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 3 7.927.9237,8801315  3% 2% 2% 100%
1.0PyPy 3 7.987.9837,9441315  4% 1% 2% 100%
1.0PyPy 3 7.997.9937,9081315  3% 3% 2% 100%
1.0PyPy 2 8.028.0266,7601337  1% 3% 100% 1%
1.0PyPy 2 8.058.0566,5321337  2% 1% 100% 2%
1.0PyPy 2 8.088.0966,8201337  2% 2% 100% 2%
4.1Cython 32.8032.828,3121315  3% 5% 100% 4%
4.2Cython 33.4233.438,1441315  7% 58% 49% 5%
4.2Cython 33.5233.538,2841315  56% 7% 50% 6%
5.1Pyston 40.7940.8028,0401337  12% 93% 5% 4%
5.2Pyston 41.3741.3840,7601337  5% 2% 4% 100%
5.3Pyston 41.6941.7328,0161337  11% 54% 27% 36%
7.2Nuitka 56.9957.0110,0721315  58% 22% 32% 10%
7.6Nuitka 60.0160.0510,2841315  30% 19% 35% 61%
7.6Python 3 60.1960.208,8761315  1% 2% 1% 100%
7.7Python 3 60.7160.718,6801315  1% 100% 0% 2%
7.7Nuitka 60.8260.8410,2841315  26% 88% 15% 13%
7.7Python 3 60.9860.998,7681315  22% 1% 80% 0%
8.8IronPython 70.0669.9681,8361337  6% 99% 3% 4%
9.0IronPython 71.6571.5681,9481337  3% 4% 99% 5%
9.1Python development version 71.9771.997,7921315  29% 3% 50% 28%
9.1IronPython 72.1372.0581,8601337  13% 36% 16% 67%
9.1Python 2 72.4272.436,7681337  3% 1% 2% 100%
9.2Python 2 73.0373.046,7721337  5% 2% 4% 100%
9.2Python development version 73.0673.127,6081315  7% 20% 65% 26%
9.6Python 2 75.9976.066,7121337  14% 7% 9% 95%
10Python development version 79.7881.527,6121315  41% 22% 41% 59%
12Jython 96.8391.19280,9041337  37% 33% 27% 20%
12Jython 99.4894.32279,8361337  24% 34% 39% 41%
12Jython 101.6795.08284,3361337  35% 34% 32% 17%
17MicroPython 135.07135.074,2321315  7% 1% 95% 1%
missing benchmark programs
Shedskin No program
Numba 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