/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 9.079.075121659  0% 1% 100% 1%
1.0C++ g++ #8 9.359.354361544  0% 1% 100% 1%
1.1C++ g++ #7 9.799.794361545  1% 1% 100% 0%
1.1C++ g++ #3 9.929.928321763  0% 1% 100% 0%
1.1C gcc #4 10.1810.194361490  0% 0% 0% 100%
1.5C++ g++ #5 13.4413.451,0761749  0% 1% 100% 0%
1.7Ada 2005 GNAT #5 15.4315.431,5002427  1% 0% 1% 100%
2.1C++ g++ #6 19.3419.344361668  0% 1% 100% 0%
2.2C++ g++ 19.5719.584361659  0% 0% 1% 100%
2.2Fortran Intel #2 19.9419.955121496  0% 0% 100% 0%
2.2Fortran Intel 20.0720.085121389  0% 0% 0% 100%
2.3C gcc #6 20.5920.604361180  1% 0% 0% 100%
2.3C gcc #3 20.6620.674401208  1% 1% 100% 0%
2.3C gcc 20.8720.874401173  0% 1% 100% 0%
2.3C++ g++ #4 20.9320.933761428  0% 1% 100% 0%
2.3C gcc #5 20.9320.943721429  1% 0% 0% 100%
2.4Fortran Intel #3 21.5321.545121299  0% 0% 0% 100%
2.4OCaml 21.8621.877161239  100% 0% 0% 0%
2.4C gcc #2 22.2022.204361263  1% 0% 0% 100%
2.5Fortran Intel #4 22.4722.485121172  0% 0% 0% 100%
2.5Go 22.8522.859921310  0% 100% 0% 0%
2.5Java  #2 22.9022.8719,5721424  99% 1% 1% 1%
2.5C# Mono #3 22.8922.9015,5921305  0% 1% 100% 0%
2.6C# Mono #2 23.1523.1615,8521410  0% 1% 100% 0%
2.6Haskell GHC #2 24.3523.172,7281874  2% 3% 100% 2%
2.6Ada 2005 GNAT #3 23.2723.281,5081740  0% 1% 100% 0%
2.7C# Mono #6 24.1324.1415,5921289  1% 0% 100% 0%
2.8Ada 2005 GNAT 25.6225.631,5081608  0% 1% 100% 0%
2.8Rust 25.6925.707801295  0% 0% 1% 100%
2.9F# Mono 25.9125.9125,0241259  1% 98% 0% 2%
2.9Scala 26.5226.4525,9041358  0% 1% 100% 0%
3.1Haskell GHC 30.2028.162,7201706  4% 4% 100% 4%
3.1Dart #3 28.5028.3264,1161420  1% 0% 100% 1%
3.2Lisp SBCL #2 28.7628.775,0401398  1% 0% 0% 100%
3.4Dart #2 30.9730.7869,2281274  1% 1% 1% 100%
3.4Clojure 42.5830.87102,8482162  16% 94% 13% 16%
3.5C# Mono #5 31.5131.5216,1201485  0% 1% 100% 0%
3.5C# Mono #4 31.8031.8015,8521461  0% 0% 100% 0%
3.8Pascal Free Pascal 34.7434.7581308  66% 0% 0% 34%
3.9Pascal Free Pascal #3 35.3935.4081418  87% 0% 0% 13%
4.1Pascal Free Pascal #2 37.0037.0181322  73% 0% 0% 28%
4.2C# Mono 38.0738.0816,1161403  0% 0% 100% 1%
4.7Lisp SBCL 42.2942.315,0401363  1% 0% 0% 100%
5.9Racket #2 53.7753.7925,7321689  0% 0% 100% 0%
11Racket 103.63103.6828,5281496  0% 0% 1% 100%
14Erlang HiPE #3 125.85125.8813,1441399  79% 21% 0% 0%
41Erlang #3 6 min6 min12,0281399  43% 8% 0% 49%
45Ruby JRuby #2 6 min6 min665,3601137  30% 29% 25% 20%
67Hack #5 10 min10 min56,0841432  0% 0% 100% 1%
73Ruby #2 11 min11 min7,5041137  0% 1% 0% 100%
79PHP #3 11 min11 min3,3361082  100% 0% 0% 0%
90Hack 13 min13 min56,1161288  0% 100% 0% 0%
104Python 3 15 min15 min5,5641181  1% 0% 0% 100%
121Perl #2 18 min18 min2,6481401  0% 0% 0% 100%
144Hack #3 21 min21 min55,3441080  0% 1% 100% 0%
Dart Failed1689
"wrong" (different) algorithm / less comparable programs
1.5C++ g++ #2 13.3913.401,0722288

 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