/mobile Handheld Friendly website

 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% 100% 0% 0%
1.0Pascal Free Pascal #2 37.2137.2381322  96% 0% 0% 4%
1.0Pascal Free Pascal 34.6734.6881308  0% 100% 0% 0%
32Fortran Intel #4 22.8222.832521172  0% 0% 100% 0%
32Fortran Intel #3 22.8922.902561299  0% 0% 0% 100%
33Fortran Intel #5 8.578.582601659  1% 1% 100% 1%
33Fortran Intel 20.3420.352601389  0% 0% 0% 100%
37C++ g++ #4 22.2422.252961428  0% 1% 100% 0%
37C gcc #5 22.5722.582961429  1% 0% 0% 100%
43C gcc #3 21.0321.043441208  0% 1% 100% 0%
43C++ g++ #7 9.089.083441545  1% 0% 0% 100%
43C gcc 20.3220.333441173  0% 1% 100% 0%
43C++ g++ #6 20.5120.523441668  1% 0% 0% 100%
43C gcc #6 20.6720.683441180  0% 1% 100% 0%
43C gcc #2 22.7022.713441263  1% 0% 0% 100%
43C++ g++ 20.2520.263441659  1% 0% 0% 100%
43C gcc #4 9.859.853441490  0% 1% 100% 0%
43C++ g++ #8 9.199.203441544  1% 1% 100% 1%
65Fortran Intel #2 20.0520.065201496  0% 0% 0% 100%
75OCaml 49.9249.935961239  0% 0% 0% 100%
79C++ g++ #3 9.969.966321763  1% 2% 0% 100%
84Rust 27.7227.736721295  1% 0% 0% 100%
91Go 24.1924.197281310  0% 100% 1% 0%
110C++ g++ #5 12.8212.838801749  0% 1% 100% 0%
155Ada 2005 GNAT #5 15.1015.111,2362427  1% 0% 0% 100%
155Ada 2005 GNAT 25.9425.961,2401608  0% 1% 100% 0%
155Ada 2005 GNAT #3 23.4923.501,2401740  1% 0% 0% 100%
274Haskell GHC #2 25.0024.402,1921874  1% 1% 100% 1%
277Haskell GHC 30.9329.132,2121706  100% 2% 2% 2%
285Perl #2 19 min19 min2,2801401  24% 16% 61% 1%
325PHP #3 12 min12 min2,5961082  0% 38% 62% 0%
493Lisp SBCL #2 37.5537.563,9441398  0% 0% 1% 100%
493Lisp SBCL 47.6847.703,9441363  0% 0% 100% 1%
532Python 3 16 min16 min4,2521181  0% 100% 0% 0%
660Ruby #2 23 min23 min5,2801137  0% 1% 100% 0%
1,054Erlang HiPE #3 162.90162.958,4281399  13% 87% 0% 0%
1,859C# Mono #6 25.1625.1714,8721289  100% 0% 1% 0%
1,865C# Mono #3 23.1023.1214,9161305  0% 100% 1% 0%
1,870C# Mono #2 23.2723.2814,9561410  0% 0% 1% 100%
1,890C# Mono #4 32.1632.1715,1201461  0% 0% 0% 100%
1,909C# Mono #5 31.7331.7415,2721485  100% 0% 0% 1%
1,919C# Mono 38.6438.6515,3521403  100% 0% 0% 1%
1,957Java  #2 24.5024.4815,6561424  0% 100% 1% 0%
2,208Racket #2 56.0456.0417,6641689  0% 0% 1% 100%
2,482Scala 23.5523.5019,8561358  1% 99% 1% 1%
2,599Racket 116.05116.0620,7881496  0% 0% 0% 100%
2,848F# Mono 25.2125.2222,7801259  1% 100% 0% 1%
5,097Dart #2 35.2134.9540,7721274  1% 0% 100% 1%
5,787Dart #3 40.5240.3346,2921420  1% 1% 100% 1%
8,010Clojure 40.7931.1564,0762162  95% 14% 13% 11%
78,893Ruby JRuby #2 7 min7 min631,1441137  23% 31% 35% 15%
Dart Failed1689
"wrong" (different) algorithm / less comparable programs
110C++ g++ #2 12.0912.108802288

 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