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.5968,3401315  5% 1% 0% 100%
1.0PyPy 3 4.624.6568,3281315  6% 98% 0% 0%
1.0PyPy 2 4.644.6774,2401337  6% 22% 0% 77%
1.0PyPy 3 4.714.7368,5121315  5% 0% 100% 0%
1.0PyPy 2 4.704.7474,4801337  14% 0% 91% 0%
1.1PyPy 2 4.734.9774,4681337  100% 1% 0% 0%
2.3Cython 10.5410.559,0441392  5% 100% 4% 0%
2.3Cython 10.5010.599,0441392  22% 82% 0% 0%
2.3Cython 10.6410.659,0121392  5% 22% 74% 6%
3.3Graal 23.5115.12534,6681315  46% 38% 39% 40%
3.5Graal 25.5116.06529,9801315  48% 52% 19% 51%
3.6Graal 27.0116.72530,4921315  45% 79% 39% 29%
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%
7.6Nuitka 34.9534.989,8441315  5% 2% 100% 1%
7.8Nuitka 35.5335.879,9281315  24% 1% 80% 10%
7.9Nuitka 36.0736.109,8921315  5% 1% 100% 2%
10Python 3 45.5745.608,8561315  5% 68% 0% 33%
10Python development version 45.6345.668,0001315  7% 9% 2% 93%
10Python development version 45.7345.768,1161315  7% 8% 2% 94%
10Python 3 46.2946.328,7921315  5% 0% 100% 0%
10Python development version 46.4546.487,9561315  6% 20% 1% 81%
10Python 3 46.5346.908,8121315  21% 0% 83% 1%
11Python 2 48.9348.956,7401337  1% 0% 0% 100%
11Python 2 50.9450.996,6161337  2% 17% 80% 6%
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%
24MicroPython 104.92107.864,4841315  32% 65% 6% 2%
24MicroPython 105.20109.114,4001315  7% 84% 14% 4%
24MicroPython 104.84109.374,4721315  1% 97% 2% 4%
missing benchmark programs
Shedskin No program
Grumpy No program
RustPython 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