n-body benchmark N=50,000,000

Each chart bar shows how many times more Memory, one ↓ n-body program used, compared to the program that used least Memory.

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.

    sortsort sort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0Pascal Free Pascal #3 47.1847.1981418  0% 1% 1% 100%
1.0Pascal Free Pascal #2 37.2037.2281322  0% 1% 1% 100%
1.0Pascal Free Pascal 34.6934.7081308  1% 0% 100% 0%
36C++ g++ #4 22.2422.252841428  0% 100% 0% 1%
36C gcc #5 22.5822.582841429  1% 100% 0% 1%
42C++ g++ #6 20.4820.493361668  0% 0% 1% 100%
42C++ g++ #7 9.109.103361545  0% 0% 1% 100%
42C++ g++ 20.2620.263361659  0% 100% 1% 1%
42C gcc #3 21.0321.043361208  0% 0% 1% 100%
42C gcc #2 22.7022.713361263  0% 0% 1% 100%
42C gcc #4 9.919.923361490  0% 0% 1% 100%
42C gcc #6 20.6720.683361180  0% 0% 1% 100%
42C++ g++ #8 9.089.093361544  0% 100% 1% 0%
42C gcc 20.3220.333361173  0% 100% 0% 1%
65Fortran Intel #3 25.2225.235161299  0% 1% 100% 0%
65Fortran Intel 20.9020.915201389  1% 0% 0% 100%
65Fortran Intel #5 10.7510.765201659  1% 0% 100% 1%
65Fortran Intel #4 22.6022.615201172  1% 0% 100% 1%
66Fortran Intel #2 20.5320.545241496  0% 1% 1% 100%
75OCaml 75.2375.256001239  1% 0% 0% 100%
78C++ g++ #3 9.949.956201763  1% 100% 0% 0%
95Go 23.1423.137601310  0% 1% 100% 1%
109C++ g++ #5 12.7612.768681749  0% 1% 1% 100%
152Ada 2005 GNAT #5 15.0815.091,2122427  1% 0% 0% 100%
152Ada 2005 GNAT #3 23.4723.481,2161740  1% 0% 1% 100%
152Ada 2005 GNAT 26.0726.081,2161608  1% 1% 0% 100%
319Perl #2 20 min20 min2,5521401  1% 0% 0% 100%
324PHP #3 11 min11 min2,5921082  0% 1% 1% 100%
456Haskell GHC #2 27.1026.373,6441874  100% 2% 1% 2%
532Python 3 16 min16 min4,2521181  0% 100% 0% 0%
605Rust 24.6224.624,8401547  1% 0% 0% 100%
636Ruby #2 24 min24 min5,0841137  22% 0% 79% 1%
1,001Lisp SBCL #2 38.2438.258,0081398  1% 0% 0% 100%
1,001Lisp SBCL 47.1447.158,0081363  1% 1% 1% 100%
1,550Haskell GHC 30.9329.1712,4001706  2% 100% 2% 2%
1,619Erlang HiPE #3 225.14225.2112,9481399  100% 1% 1% 1%
2,208Racket #2 56.0456.0417,6641689  0% 0% 1% 100%
2,308Dart #2 33.9233.7018,4641274  100% 1% 1% 1%
2,332Dart #3 46.9446.5518,6521420  0% 1% 1% 100%
2,399C# Mono #2 23.0923.1019,1921410  1% 0% 100% 1%
2,411C# Mono #6 24.6724.6819,2881289  100% 0% 1% 1%
2,425Java  24.4724.4519,4001424  0% 0% 1% 100%
2,426C# Mono #3 22.0422.0519,4081305  100% 1% 1% 1%
2,428C# Mono #8 22.4122.4119,4201343  100% 0% 0% 1%
2,439Java  #2 24.4724.4519,5081424  1% 1% 100% 0%
2,453C# Mono 38.4938.5119,6241403  1% 100% 0% 0%
2,599Racket 116.05116.0620,7881496  0% 0% 0% 100%
2,857Scala 23.4923.4322,8521358  1% 1% 1% 100%
3,397F# Mono 25.6725.6827,1761259  1% 100% 0% 1%
6,121Clojure #2 38.0136.7148,9641440  3% 95% 3% 5%
6,174Clojure 29.4228.0349,3922162  4% 2% 97% 3%
87,255Ruby JRuby #2 5 min5 min698,0361137  17% 42% 25% 20%
C# Mono #5 Failed1485
C# Mono #7 Failed1539
C# Mono #4 Failed1461
"wrong" (different) algorithm / less comparable programs
109C++ g++ #2 11.9311.938682288

 n-body benchmark : Double-precision N-body simulation

You can write your own program for this task and contribute to the benchmarks game by following these general instructions.

More specifically:

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.

Each program should model the orbits of Jovian planets, using the same simple symplectic-integrator - see the Java program.

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