n-body benchmark N=50,000,000

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

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.

    sortsortsort 
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0PHP #3 12 min12 min2,5961082  0% 38% 62% 0%
1.1Ruby JRuby #2 7 min7 min631,1441137  23% 31% 35% 15%
1.1Ruby #2 23 min23 min5,2801137  0% 1% 100% 0%
1.1Fortran Intel #4 22.8222.832521172  0% 0% 100% 0%
1.1C gcc 20.3220.333361173  0% 100% 0% 1%
1.1C gcc #6 20.6720.683361180  0% 0% 1% 100%
1.1Python 3 16 min16 min4,2521181  0% 100% 0% 0%
1.1C gcc #3 21.0321.043361208  0% 0% 1% 100%
1.1OCaml 49.9249.935961239  0% 0% 0% 100%
1.2F# Mono 25.5425.5527,4321259  1% 100% 0% 1%
1.2C gcc #2 22.7022.713361263  0% 0% 1% 100%
1.2Dart #2 39.7039.5149,3841274  1% 1% 100% 1%
1.2C# Mono #6 24.8024.8219,2441289  1% 0% 0% 100%
1.2Fortran Intel #3 22.8922.902561299  0% 0% 0% 100%
1.2C# Mono #3 22.0422.0519,3761305  1% 100% 0% 1%
1.2Pascal Free Pascal 34.6934.7081308  1% 0% 100% 0%
1.2Go 27.1727.177721310  1% 1% 0% 100%
1.2Pascal Free Pascal #2 37.2037.2281322  0% 1% 1% 100%
1.3Scala 23.5523.5019,8561358  1% 99% 1% 1%
1.3Lisp SBCL 46.4046.415,7761363  0% 0% 1% 100%
1.3Rust 26.0926.104,9241371  0% 1% 100% 0%
1.3Fortran Intel 20.3420.352601389  0% 0% 0% 100%
1.3Lisp SBCL #2 38.4338.445,7761398  1% 4% 2% 100%
1.3Erlang HiPE #3 162.90162.958,4281399  13% 87% 0% 0%
1.3Perl #2 19 min19 min2,2801401  24% 16% 61% 1%
1.3C# Mono 38.6638.6819,5921403  1% 100% 0% 1%
1.3C# Mono #2 23.2223.2419,1561410  1% 0% 1% 100%
1.3Pascal Free Pascal #3 47.1847.1981418  0% 1% 1% 100%
1.3Dart #3 56.6856.4366,3441420  1% 100% 0% 1%
1.3Java  #2 24.5024.4815,6561424  0% 100% 1% 0%
1.3C++ g++ #4 22.2422.252841428  0% 100% 0% 1%
1.3C gcc #5 22.5822.582841429  1% 100% 0% 1%
1.3Clojure #2 37.9836.7148,0681440  2% 2% 3% 98%
1.4C gcc #4 9.919.923361490  0% 0% 1% 100%
1.4Fortran Intel #2 20.0520.065201496  0% 0% 0% 100%
1.4Racket 116.05116.0620,7881496  0% 0% 0% 100%
1.4C++ g++ #8 9.089.093361544  0% 100% 1% 0%
1.4C++ g++ #7 9.109.103361545  0% 0% 1% 100%
1.5Ada 2005 GNAT 26.0726.081,2161608  1% 1% 0% 100%
1.5Fortran Intel #5 8.578.582601659  1% 1% 100% 1%
1.5C++ g++ 20.2620.263361659  0% 100% 1% 1%
1.5C++ g++ #6 20.4820.493361668  0% 0% 1% 100%
1.6Racket #2 56.0456.0417,6641689  0% 0% 1% 100%
1.6Haskell GHC 30.9329.132,2121706  100% 2% 2% 2%
1.6Ada 2005 GNAT #3 23.4723.481,2161740  1% 0% 1% 100%
1.6C++ g++ #5 12.7612.768681749  0% 1% 1% 100%
1.6C++ g++ #3 9.949.956201763  1% 100% 0% 0%
1.7Haskell GHC #2 25.0024.402,1921874  1% 1% 100% 1%
2.0Clojure 29.3927.9946,6842162  4% 3% 97% 3%
2.2Ada 2005 GNAT #5 15.0815.091,2122427  1% 0% 0% 100%
C# Mono #5 Failed1485
C# Mono #7 Failed1539
C# Mono #4 Failed1461
"wrong" (different) algorithm / less comparable programs
2.1C++ g++ #2 11.9311.938682288

 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.

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