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 6.896.9072,4761337  1% 0% 2% 99%
1.0PyPy 2 6.906.9072,4921337  100% 0% 0% 0%
1.0PyPy 3 6.926.9266,7841315  0% 100% 0% 1%
1.0PyPy 3 6.926.9266,1481315  3% 1% 97% 1%
1.0PyPy 2 6.986.9872,4881337  88% 1% 12% 1%
1.0PyPy 3 7.217.2166,3881315  0% 1% 100% 1%
1.9Cython 12.8512.858,9321392  8% 54% 57% 8%
1.9Cython 12.9912.998,7961392  8% 10% 8% 100%
1.9Cython 13.0013.018,9121392  15% 10% 95% 10%
4.3Pyston 29.4429.4526,5961337  0% 53% 0% 47%
4.3Pyston 29.4929.4926,6481337  0% 0% 100% 0%
4.5Pyston 31.0531.0626,7241337  2% 0% 98% 0%
6.1Nuitka 41.8541.8510,1521315  1% 79% 1% 22%
6.1Nuitka 41.9341.9310,1801315  1% 1% 100% 0%
6.3Nuitka 43.4743.4810,4801315  100% 1% 0% 1%
6.4Python 3 43.8943.898,7801315  11% 1% 89% 0%
6.4Python 3 44.3244.328,8561315  1% 0% 100% 1%
6.5Python 3 44.6044.619,0921315  1% 1% 0% 100%
7.1Python 2 49.2849.286,9361337  0% 0% 100% 0%
7.2Python 2 49.9349.936,9161337  0% 5% 0% 95%
7.4Python 2 50.8250.826,7561337  100% 0% 0% 0%
7.6Python development version 52.1752.177,5241315  0% 49% 0% 51%
7.6Python development version 52.4752.477,7361315  0% 27% 0% 73%
7.6Python development version 52.7152.717,7121315  0% 0% 100% 0%
7.9IronPython 55.2154.6763,0401337  0% 66% 0% 34%
8.0IronPython 55.0055.1965,2081337  69% 7% 11% 12%
8.2IronPython 56.3756.6963,3241337  30% 0% 68% 0%
8.5Numba 58.4358.4497,4921333  0% 100% 0% 0%
8.6Numba 59.6259.6297,3761333  0% 26% 0% 74%
8.7Numba 59.7460.0196,7361333  0% 0% 100% 0%
9.8Jython 71.2367.65297,4361337  28% 28% 24% 26%
10Jython 72.5868.57297,2521337  34% 21% 30% 21%
10Jython 74.2070.26299,0881337  20% 25% 33% 28%
15MicroPython 103.71103.724,5481315  0% 30% 0% 70%
15MicroPython 103.81103.814,3681315  0% 0% 100% 0%
15MicroPython 104.01104.014,3841315  60% 0% 41% 0%
missing benchmark programs
Shedskin 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