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% 0% 1% 100%
1.0Pascal Free Pascal #2 37.2037.2281322  1% 0% 0% 100%
1.0Pascal Free Pascal 34.7134.7281308  0% 0% 0% 100%
36C++ g++ #4 22.2422.252841428  1% 1% 0% 100%
36C gcc #5 22.5722.582841429  0% 1% 0% 100%
42C++ g++ #6 20.4820.493361668  1% 1% 0% 100%
42C++ g++ #7 9.109.103361545  2% 0% 5% 100%
42C gcc 20.3220.323361173  0% 0% 1% 100%
42C gcc #3 21.0321.033361208  0% 0% 1% 100%
42C gcc #2 22.7022.713361263  0% 0% 1% 100%
42C gcc #4 9.919.923361490  0% 1% 1% 100%
42C gcc #6 20.6820.693361180  0% 1% 1% 100%
42C++ g++ #8 9.089.083361544  0% 0% 1% 100%
42C++ g++ 20.2520.263361659  0% 1% 0% 100%
65Fortran Intel #3 25.2125.225161299  1% 0% 0% 100%
65Fortran Intel 20.8820.895201389  1% 1% 0% 100%
65Fortran Intel #5 10.7410.745201659  1% 1% 1% 100%
65Fortran Intel #4 22.6022.605201172  1% 0% 0% 100%
66Fortran Intel #2 20.5320.545241496  0% 0% 0% 100%
75OCaml 75.2175.236001239  1% 0% 1% 100%
78C++ g++ #3 9.949.956201763  1% 0% 1% 100%
96Go 23.0923.107641310  0% 1% 0% 100%
109C++ g++ #5 12.7412.758681749  0% 1% 1% 100%
109Lua 11 min11 min8721201  0% 1% 1% 100%
109Lua #2 9 min9 min8721193  0% 1% 1% 100%
109Lua #4 9 min9 min8721305  0% 0% 1% 100%
152Ada 2005 GNAT #3 23.4623.471,2121740  1% 0% 0% 100%
152Ada 2005 GNAT #5 15.0815.091,2122427  1% 0% 0% 100%
152Ada 2005 GNAT 26.0726.081,2161608  1% 1% 0% 100%
276Haskell GHC 28.5528.562,2081706  0% 1% 0% 100%
277Haskell GHC #2 26.0726.082,2121874  1% 0% 0% 100%
283Perl #2 19 min19 min2,2641401  0% 1% 1% 100%
323PHP #3 11 min11 min2,5841082  0% 0% 1% 100%
529Python 3 16 min16 min4,2321181  1% 0% 1% 100%
607Rust 24.5824.594,8521474  0% 1% 1% 100%
641Ruby #2 24 min24 min5,1241137  0% 1% 1% 100%
661C CINT 20h 06 min20h 06 min5,2881173  0% 0% 0% 100%
859JavaScript V8 #2 41.6541.666,8681527  0% 5% 1% 100%
871JavaScript V8 44.6644.676,9681287  0% 0% 1% 100%
982Lisp SBCL #2 38.4238.437,8521398  1% 0% 0% 100%
982Lisp SBCL 46.0246.037,8521363  0% 0% 1% 100%
1,308Erlang HiPE #3 217.95218.0210,4601399  1% 0% 0% 100%
2,227Dart #2 33.9233.9417,8121274  0% 1% 1% 100%
2,264Dart #3 46.8146.8318,1121420  0% 1% 1% 100%
2,399C# Mono #2 23.0923.1019,1921410  0% 1% 1% 100%
2,411C# Mono #6 24.6724.6819,2881289  1% 1% 0% 100%
2,414Java  24.4824.4919,3081424  1% 1% 1% 100%
2,427C# Mono #3 22.0422.0419,4121305  0% 1% 1% 100%
2,427C# Mono #8 22.4122.4219,4161343  1% 0% 1% 100%
2,453C# Mono 38.5038.5219,6241403  0% 1% 1% 100%
2,455Java  #2 24.5024.5219,6361424  1% 0% 1% 100%
2,771Racket #2 55.5255.5422,1681689  1% 1% 1% 100%
2,932Smalltalk VisualWorks 5 min5 min23,4521652  0% 0% 1% 100%
3,135Scala 23.8423.8525,0761358  1% 1% 0% 100%
3,396F# Mono 25.6625.6727,1681259  0% 1% 1% 100%
4,458Racket 116.12116.2035,6601496  0% 1% 1% 100%
6,049Clojure #2 37.8437.8648,3881440  1% 0% 1% 100%
6,064Clojure 29.1629.1748,5122162  0% 1% 1% 100%
89,198Ruby JRuby #2 6 min6 min713,5801137  0% 1% 1% 100%
C# Mono #5 Failed1485
C# Mono #7 Failed1539
C# Mono #4 Failed1461
"wrong" (different) algorithm / less comparable programs
109C++ g++ #2 12.1112.118682288
1,092JavaScript V8 #3 32.9832.998,7321505

 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