/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 #2 37.2137.2381322  96% 0% 0% 4%
1.0Pascal Free Pascal #3 47.1847.1981418  0% 100% 0% 0%
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 20.3420.352601389  0% 0% 0% 100%
37C++ g++ #4 20.7920.802921428  52% 4% 7% 50%
37C gcc #5 22.9822.992921429  0% 1% 100% 0%
40ATS #2 20.6520.653201920  0% 0% 0% 100%
42C gcc #2 22.2222.243361263  0% 0% 100% 0%
42C gcc #4 8.858.853361490  0% 0% 100% 1%
42C++ g++ 20.9320.943361659  75% 0% 0% 25%
42C gcc #3 23.8423.853361208  79% 0% 0% 21%
42C gcc 20.7820.793361173  0% 0% 100% 0%
42C gcc #6 20.9820.993361180  87% 0% 0% 13%
42C++ g++ #6 20.6020.613361668  100% 0% 0% 1%
65Fortran Intel #2 20.0520.065201496  0% 0% 0% 100%
73OCaml 47.6747.685801239  1% 0% 0% 100%
78C++ g++ #3 10.4110.426201763  1% 1% 0% 100%
109C++ g++ #5 10.5510.568681749  57% 0% 0% 43%
126Go 35.6935.681,0041310  0% 100% 0% 0%
154Ada 2005 GNAT #5 15.0115.021,2322427  0% 0% 100% 0%
155Ada 2005 GNAT #3 23.5423.551,2361740  83% 0% 0% 17%
155Ada 2005 GNAT 26.0226.031,2361608  71% 0% 0% 29%
251Haskell GHC 29.7627.132,0081695  27% 32% 17% 35%
251Haskell GHC #2 24.7724.022,0081874  11% 58% 35% 1%
285Perl #2 19 min19 min2,2801401  24% 16% 61% 1%
315PHP #3 12 min12 min2,5201082  77% 0% 23% 0%
511Lisp SBCL #2 37.5537.564,0881398  0% 0% 0% 100%
511Lisp SBCL 47.4047.424,0881363  1% 0% 0% 100%
590Python 3 18 min18 min4,7161181  93% 0% 0% 7%
611Ruby 2.0 #2 26 min26 min4,8841137  69% 10% 22% 1%
1,054Erlang HiPE #3 162.90162.958,4281399  13% 87% 0% 0%
1,747Java 7  #2 24.4124.3913,9761424  0% 0% 0% 100%
2,028C# Mono #3 23.7723.7916,2201305  100% 0% 0% 0%
2,028C# Mono 40.2140.2216,2241403  0% 100% 1% 0%
2,028C# Mono #2 24.0724.0816,2241410  0% 0% 0% 100%
2,028C# Mono #6 28.7728.7816,2241289  0% 100% 0% 0%
2,040C# Mono #4 32.5832.5916,3201461  0% 100% 0% 1%
2,066C# Mono #5 32.3032.3116,5241485  0% 100% 0% 0%
2,158Racket #2 55.3455.3417,2641689  0% 0% 0% 100%
2,295Racket 120.12120.1318,3561496  0% 1% 100% 0%
2,347Scala 23.9723.9118,7761358  0% 1% 100% 0%
2,890F# Mono 31.3831.3923,1161259  100% 0% 0% 0%
4,855Dart #2 93.4093.5338,8401297  0% 0% 0% 100%
4,872Dart 105.08105.2038,9721689  0% 0% 100% 0%
8,387Clojure 46.8036.8367,0922162  10% 12% 10% 95%
73,225Ruby JRuby #2 9 min9 min585,7961137  52% 0% 0% 48%
"wrong" (different) algorithm / less comparable programs
78C++ g++ #2 10.5510.566202288

 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