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,5881082  0% 0% 0% 100%
1.1Ruby JRuby #2 6 min6 min713,5801137  0% 1% 1% 100%
1.1Fortran Intel #4 22.8922.892521172  0% 0% 0% 100%
1.1C gcc 20.3220.323361173  0% 0% 1% 100%
1.1C CINT 20h 06 min20h 06 min5,2881173  0% 0% 0% 100%
1.1C gcc #6 20.6820.693361180  0% 1% 1% 100%
1.1Python 3 16 min16 min4,2521181  1% 0% 0% 100%
1.1Lua #2 7 min7 min8361193  0% 0% 0% 100%
1.1Lua 8 min8 min8361201  0% 0% 0% 100%
1.1C gcc #3 21.0321.033361208  0% 0% 1% 100%
1.1OCaml 49.9149.935961239  0% 0% 0% 100%
1.2F# Mono 25.6625.6727,1681259  0% 1% 1% 100%
1.2C gcc #2 22.7022.713361263  0% 0% 1% 100%
1.2Dart #2 35.4235.4312,6161274  1% 0% 1% 100%
1.2JavaScript V8 45.0245.037,4801287  0% 1% 0% 100%
1.2C# Mono #6 24.6724.6819,2881289  1% 1% 0% 100%
1.2Fortran Intel #3 22.8922.902561299  0% 1% 0% 100%
1.2C# Mono #3 22.0422.0419,4121305  0% 1% 1% 100%
1.2Lua #4 7 min7 min8361305  0% 0% 0% 100%
1.2Pascal Free Pascal 34.7134.7281308  0% 0% 0% 100%
1.2Go 27.1727.187721310  1% 0% 1% 100%
1.2Rust #2 24.4224.444,6801321  1% 1% 0% 100%
1.2Pascal Free Pascal #2 37.2037.2281322  1% 0% 0% 100%
1.3Scala 23.8423.8525,0761358  1% 1% 0% 100%
1.3Lisp SBCL 46.4046.415,7761363  1% 1% 0% 100%
1.3Rust #3 22.9722.984,6801367  1% 0% 0% 100%
1.3Rust 21.8921.904,6801371  1% 0% 0% 100%
1.3Fortran Intel 20.3420.352601389  0% 0% 1% 100%
1.3Lisp SBCL #2 39.0939.105,7721398  1% 0% 0% 100%
1.3Erlang HiPE #3 167.57167.617,6321399  0% 0% 0% 100%
1.3Perl #2 18 min18 min1,9921401  0% 0% 0% 100%
1.3C# Mono 38.5038.5219,6241403  0% 1% 1% 100%
1.3C# Mono #2 23.0923.1019,1921410  0% 1% 1% 100%
1.3Pascal Free Pascal #3 47.1847.1981418  0% 0% 1% 100%
1.3Dart #3 48.0748.0914,2321420  1% 0% 0% 100%
1.3Java  #2 24.5024.5219,6361424  1% 0% 1% 100%
1.3C++ g++ #4 22.2422.252841428  1% 1% 0% 100%
1.3C gcc #5 22.5722.582841429  0% 1% 0% 100%
1.3Clojure #2 37.8437.8648,3881440  1% 0% 1% 100%
1.4C gcc #4 9.919.923361490  0% 1% 1% 100%
1.4Racket 115.98116.0420,7761496  0% 1% 1% 100%
1.4Fortran Intel #2 20.0520.065201496  0% 0% 1% 100%
1.4JavaScript V8 #2 41.0141.029,4081527  0% 1% 0% 100%
1.4C++ g++ #8 9.089.083361544  0% 0% 1% 100%
1.4C++ g++ #7 9.109.103361545  2% 0% 5% 100%
1.5Ada 2005 GNAT 26.0726.081,2161608  1% 1% 0% 100%
1.5Smalltalk VisualWorks 263.11263.2421,9561652  0% 0% 0% 100%
1.5Fortran Intel #5 8.578.572601659  0% 0% 0% 100%
1.5C++ g++ 20.2520.263361659  0% 1% 0% 100%
1.5C++ g++ #6 20.4820.493361668  1% 1% 0% 100%
1.6Racket #2 56.0256.0517,7081689  0% 0% 1% 100%
1.6Haskell GHC 28.5328.552,2401706  0% 0% 1% 100%
1.6Ada 2005 GNAT #3 23.4623.471,2121740  1% 0% 0% 100%
1.6C++ g++ #5 12.7412.758681749  0% 1% 1% 100%
1.6C++ g++ #3 9.949.956201763  1% 0% 1% 100%
1.7Haskell GHC #2 24.2024.222,2401874  1% 0% 1% 100%
2.0Clojure 29.1629.1748,5122162  0% 1% 1% 100%
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
Ruby #2 Timed Out5 min1137
"wrong" (different) algorithm / less comparable programs
1.4JavaScript V8 #3 32.6232.637,3881505
2.1C++ g++ #2 12.1112.118682288

 n-body benchmark : Double-precision N-body simulation

You can write your own program for this task and contribute to the benchmarks game by following these general instructions.

More specifically:

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