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 4.574.6067,9001315  2% 99% 3% 4%
1.0PyPy 3 4.594.6267,8361315  16% 3% 86% 2%
1.0PyPy 3 4.624.6467,6361315  3% 4% 3% 100%
1.0PyPy 2 4.624.6476,7721337  1% 5% 1% 100%
1.0PyPy 2 4.624.6576,4361337  12% 5% 88% 0%
1.0PyPy 2 4.634.6576,4321337  99% 5% 1% 1%
1.6Graal 7.307.13387,3961315  2% 3% 100% 5%
1.6Graal 7.317.13387,4961315  2% 4% 100% 2%
1.6Graal 7.327.14387,4481315  4% 3% 2% 100%
2.1Cython 9.749.758,6721392  6% 1% 1% 100%
2.1Cython 9.879.888,4961392  6% 1% 100% 1%
2.2Cython 9.889.898,6481392  5% 1% 100% 1%
6.4Pyston 29.4429.4526,5961337  0% 53% 0% 47%
6.4Pyston 29.4929.4926,6481337  0% 0% 100% 0%
6.8Pyston 31.0531.0626,7241337  2% 0% 98% 0%
8.3Nuitka 38.1038.149,6721315  37% 5% 64% 1%
8.4Nuitka 38.7938.829,7241315  1% 5% 1% 100%
8.5Nuitka 39.1139.169,6641315  1% 6% 1% 99%
9.6Python 3 44.1744.208,8561315  7% 4% 3% 100%
9.6Python 3 44.2944.338,7961315  7% 100% 3% 4%
9.8Python 3 45.0545.108,7561315  13% 7% 7% 100%
11Python 2 48.9348.956,7401337  1% 0% 0% 100%
11Python development version 50.0050.048,0161315  1% 5% 100% 1%
11Python 2 50.9450.996,6161337  2% 17% 80% 6%
11Python development version 51.0351.077,9441315  1% 5% 1% 100%
11Python development version 51.4051.468,1881315  64% 5% 36% 1%
12Python 2 53.1753.336,6921337  30% 28% 64% 20%
12IronPython 55.2154.6763,0401337  0% 66% 0% 34%
12IronPython 55.0055.1965,2081337  69% 7% 11% 12%
12IronPython 56.3756.6963,3241337  30% 0% 68% 0%
13Numba 58.4358.4497,4921333  0% 100% 0% 0%
13Numba 59.6259.6297,3761333  0% 26% 0% 74%
13Numba 59.7460.0196,7361333  0% 0% 100% 0%
15Jython 71.2367.65297,4361337  28% 28% 24% 26%
15Jython 72.5868.57297,2521337  34% 21% 30% 21%
15Jython 74.2070.26299,0881337  20% 25% 33% 28%
23MicroPython 104.45104.604,6841315  0% 12% 0% 88%
23MicroPython 104.54104.694,5441315  0% 0% 0% 100%
23MicroPython 104.71104.794,6841315  0% 0% 100% 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