/mobile Handheld Friendly website

 n-body benchmark N=50,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.0C gcc #4 9.089.093361490  0% 0% 0% 100%
1.1C++ g++ #3 10.4210.436201763  0% 1% 1% 100%
1.2C++ g++ #5 10.5510.566201749  0% 1% 1% 100%
1.7Ada 2005 GNAT #5 15.0015.011,2322427  0% 0% 0% 100%
2.2Fortran Intel #2 20.0520.065201496  0% 0% 1% 100%
2.2Fortran Intel 20.3420.352601389  0% 0% 1% 100%
2.3C++ g++ #6 20.6020.613361668  0% 0% 0% 100%
2.3ATS #2 20.6520.653201920  0% 1% 0% 100%
2.3C gcc 20.7720.783361173  0% 0% 0% 100%
2.3C++ g++ #4 20.7920.802921428  0% 0% 0% 100%
2.3C++ g++ 20.9320.943361659  0% 0% 0% 100%
2.3C gcc #6 20.9820.993361180  0% 0% 0% 100%
2.5C gcc #2 22.3422.363361263  0% 0% 0% 100%
2.5Fortran Intel #4 22.8922.892521172  0% 0% 0% 100%
2.5Fortran Intel #3 22.8922.902561299  0% 1% 0% 100%
2.5C gcc #5 22.9822.992921429  1% 0% 1% 100%
2.5C# Mono #3 23.0923.0914,0481305  0% 0% 0% 100%
2.6C# Mono #2 23.3423.3514,0521410  1% 0% 0% 100%
2.6Ada 2005 GNAT #3 23.5423.551,2361740  0% 0% 0% 100%
2.6Haskell GHC #2 23.6823.691,8401874  0% 0% 0% 100%
2.6C gcc #3 23.8423.853361208  0% 0% 0% 100%
2.6Scala 23.9123.9118,7561358  0% 0% 0% 100%
2.7Java 7  #2 24.4024.4113,9961424  0% 0% 0% 100%
2.9Ada 2005 GNAT 26.0226.031,2361608  0% 0% 0% 100%
2.9Haskell GHC 26.0326.041,8481695  0% 0% 0% 100%
3.1C# Mono #6 28.1928.2014,0521289  0% 0% 0% 100%
3.8Pascal Free Pascal 34.7134.7381308  0% 0% 0% 100%
3.8F# Mono 34.9334.9417,9481259  1% 0% 0% 100%
3.9Go 35.7035.711,0041310  0% 1% 0% 100%
4.1Pascal Free Pascal #2 37.2137.2381322  0% 0% 0% 100%
4.1Lisp SBCL #2 37.5537.564,0841398  0% 0% 0% 100%
4.3C# Mono 39.4939.5014,3161403  0% 0% 0% 100%
4.5JavaScript V8 #2 41.2841.305,9601527  0% 0% 0% 100%
4.7Clojure 42.8242.8467,4922162  0% 0% 0% 100%
4.7JavaScript V8 42.9242.946,0721287  0% 0% 0% 100%
5.2Pascal Free Pascal #3 47.4447.4581418  0% 0% 0% 100%
5.2Lisp SBCL 47.4547.474,0841363  0% 0% 0% 100%
5.2OCaml 47.6547.675801239  0% 0% 0% 100%
6.1Racket #2 55.2255.2517,2641689  0% 0% 0% 100%
10Dart #2 93.2193.3338,8401297  0% 0% 0% 100%
12Dart 105.28105.4238,9721689  0% 0% 0% 100%
13Racket 119.78119.8620,4121496  0% 0% 0% 100%
18Erlang HiPE #3 167.57167.617,6321399  0% 0% 0% 100%
29Smalltalk VisualWorks 263.11263.2421,9561652  0% 0% 0% 100%
51Lua #2 7 min7 min8361193  0% 0% 0% 100%
52Lua #4 7 min7 min8361305  0% 0% 0% 100%
57Lua 8 min8 min8361201  0% 0% 0% 100%
62Ruby JRuby #2 9 min9 min585,4281137  0% 0% 0% 100%
85PHP #3 12 min12 min2,5161082  0% 0% 0% 100%
121Python 3 18 min18 min4,7001181  0% 0% 0% 100%
125Perl #2 18 min18 min1,9921401  0% 0% 0% 100%
177Ruby 2.0 #2 26 min26 min4,8841137  0% 0% 0% 100%
7,964C CINT 20h 06 min20h 06 min5,2881173  0% 0% 0% 100%
C# Mono #5 Failed1485
C# Mono #4 Failed1461
"wrong" (different) algorithm / less comparable programs
1.2C++ g++ #2 10.5510.568682288
3.6JavaScript V8 #3 33.1533.175,9561505

 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