/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.0Fortran Intel #5 8.578.572601659  0% 0% 0% 100%
1.1C++ g++ #8 9.089.083361544  0% 0% 1% 100%
1.1C++ g++ #7 9.109.103361545  2% 0% 5% 100%
1.2C gcc #4 9.919.923361490  0% 1% 1% 100%
1.2C++ g++ #3 9.949.956201763  1% 0% 1% 100%
1.5C++ g++ #5 12.7412.758681749  0% 1% 1% 100%
1.8Ada 2005 GNAT #5 15.1115.121,2362427  0% 1% 1% 100%
2.3Fortran Intel #2 20.0520.065201496  0% 0% 1% 100%
2.4C++ g++ 20.2520.263361659  0% 1% 0% 100%
2.4C gcc 20.3220.323361173  0% 0% 1% 100%
2.4Fortran Intel 20.3420.352601389  0% 0% 1% 100%
2.4C++ g++ #6 20.4820.493361668  1% 1% 0% 100%
2.4C gcc #6 20.6820.693361180  0% 1% 1% 100%
2.5C gcc #3 21.0321.033361208  0% 0% 1% 100%
2.6C++ g++ #4 22.2422.252841428  1% 1% 0% 100%
2.6C gcc #5 22.5722.582841429  0% 1% 0% 100%
2.6C gcc #2 22.7022.713361263  0% 0% 1% 100%
2.7Fortran Intel #4 22.8922.892521172  0% 0% 0% 100%
2.7Fortran Intel #3 22.8922.902561299  0% 1% 0% 100%
2.7C# Mono #3 23.0623.0714,9161305  0% 0% 0% 100%
2.7C# Mono #2 23.2523.2614,9521410  0% 0% 1% 100%
2.7Ada 2005 GNAT #3 23.5023.511,2401740  0% 0% 1% 100%
2.8Scala 23.5823.5919,9161358  0% 0% 1% 100%
2.8Go 24.0324.047241310  1% 2% 2% 100%
2.8Haskell GHC #2 24.2024.222,2401874  1% 0% 1% 100%
2.9Java  #2 24.5424.5515,6041424  0% 0% 1% 100%
2.9C# Mono #6 25.1625.1714,8721289  0% 1% 0% 100%
2.9F# Mono 25.1925.2022,7761259  0% 1% 1% 100%
3.0Ada 2005 GNAT 25.9525.961,2401608  1% 0% 0% 100%
3.2Rust 27.7227.736721295  0% 0% 1% 100%
3.3Haskell GHC 28.5328.552,2401706  0% 0% 1% 100%
3.4Clojure 29.2029.2144,6882162  1% 0% 0% 100%
3.7C# Mono #5 31.7831.7915,2721485  0% 0% 0% 100%
3.7C# Mono #4 32.1032.1115,1241461  1% 0% 0% 100%
4.0Pascal Free Pascal 34.7134.7281308  0% 0% 1% 100%
4.1Dart #2 35.1135.1241,1681274  0% 1% 1% 100%
4.3Pascal Free Pascal #2 37.2037.2281322  1% 1% 0% 100%
4.4Lisp SBCL #2 37.5537.563,9441398  0% 0% 0% 100%
4.5C# Mono 38.6238.6315,3521403  0% 1% 1% 100%
4.7Dart #3 40.5540.5646,5481420  0% 1% 1% 100%
4.9JavaScript V8 #2 42.1242.138,6401527  0% 0% 0% 100%
5.2JavaScript V8 44.9544.968,6201287  1% 0% 0% 100%
5.5Pascal Free Pascal #3 47.1847.1981418  1% 0% 0% 100%
5.6Lisp SBCL 47.6847.693,9441363  1% 0% 0% 100%
5.8OCaml 49.9149.935961239  0% 0% 0% 100%
6.5Racket #2 56.0256.0517,7081689  0% 0% 1% 100%
14Racket 115.98116.0420,7761496  0% 1% 1% 100%
20Erlang HiPE #3 167.57167.617,6321399  0% 0% 0% 100%
31Smalltalk VisualWorks 263.11263.2421,9561652  0% 0% 0% 100%
50Ruby JRuby #2 7 min7 min632,1801137  0% 1% 1% 100%
54Lua #2 7 min7 min8361193  0% 0% 0% 100%
55Lua #4 7 min7 min8361305  0% 0% 0% 100%
61Lua 8 min8 min8361201  0% 0% 0% 100%
90PHP #3 12 min12 min2,5881082  0% 0% 0% 100%
117Python 3 16 min16 min4,2521181  1% 0% 0% 100%
133Perl #2 18 min18 min1,9921401  0% 0% 0% 100%
167Ruby #2 23 min23 min5,2881137  0% 0% 0% 100%
8,445C CINT 20h 06 min20h 06 min5,2881173  0% 0% 0% 100%
Dart Failed1689
"wrong" (different) algorithm / less comparable programs
1.4C++ g++ #2 12.1112.118682288
3.9JavaScript V8 #3 33.6633.678,4761505

 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