/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.339.344321490  100% 0% 0% 1%
1.1C++ g++ #3 10.0710.078281763  0% 0% 1% 100%
1.2C++ g++ #5 10.8010.808281749  0% 0% 0% 100%
1.7Ada 2005 GNAT #5 15.4315.441,5042427  86% 0% 0% 14%
2.1C++ g++ #6 19.3419.354321668  0% 0% 0% 100%
2.1C++ g++ 19.5819.594361659  0% 0% 0% 100%
2.1Fortran Intel #2 19.9419.955121496  0% 0% 100% 0%
2.2Fortran Intel 20.0720.085121389  0% 0% 0% 100%
2.2ATS #2 20.2820.294281920  0% 100% 0% 0%
2.2C++ g++ #4 20.7020.713721428  0% 0% 0% 100%
2.2C gcc #3 20.8420.854321208  0% 0% 0% 100%
2.2C gcc #6 20.9220.944361180  0% 0% 0% 100%
2.3C gcc 21.2621.274361173  0% 0% 0% 100%
2.3Fortran Intel #3 21.5321.545121299  0% 0% 0% 100%
2.4Fortran Intel #4 22.4722.485121172  0% 0% 0% 100%
2.4C gcc #2 22.4722.484361263  0% 0% 0% 100%
2.4Java 7  #2 22.5122.5017,2561424  0% 0% 100% 0%
2.4C# Mono #3 22.7722.7814,6281305  1% 0% 0% 100%
2.5C# Mono #2 23.2123.2214,6281410  0% 0% 0% 100%
2.5Ada 2005 GNAT #3 23.2823.291,5081740  89% 0% 0% 11%
2.5Haskell GHC #2 24.8623.442,3761874  64% 6% 17% 20%
2.5Scala 23.5223.4723,7081358  1% 2% 1% 100%
2.5C gcc #5 23.6823.693721429  0% 0% 0% 100%
2.6OCaml 23.8223.837161239  0% 0% 0% 100%
2.6C# Mono #6 24.3824.3914,6321289  100% 0% 0% 0%
2.8Ada 2005 GNAT 25.8925.901,5121608  77% 0% 1% 23%
2.8Clojure 27.2026.1650,6882162  97% 2% 2% 4%
2.9Go 26.6326.631,2721310  86% 14% 0% 0%
2.9Lisp SBCL #2 26.7426.755,0481398  0% 0% 0% 100%
3.0Haskell GHC 30.8628.352,3761695  2% 2% 85% 17%
3.4C# Mono #5 31.4731.4815,1561485  0% 0% 0% 100%
3.4C# Mono #4 31.5131.5214,8921461  100% 0% 0% 0%
3.7F# Mono 35.5034.3019,9921259  64% 1% 5% 34%
3.7Pascal Free Pascal 34.7434.7581308  66% 0% 0% 34%
3.8Pascal Free Pascal #3 35.3935.4081418  87% 0% 0% 13%
4.0Pascal Free Pascal #2 37.0037.0181322  73% 0% 0% 28%
4.1C# Mono 38.3338.3415,1161403  0% 0% 0% 100%
4.6Lisp SBCL 42.8042.825,0441363  0% 0% 100% 0%
5.8Racket #2 54.4654.4926,9001689  0% 0% 0% 100%
8.8Dart #2 82.4582.5741,6361297  0% 100% 0% 0%
10Dart 97.0897.2241,6281689  0% 0% 0% 100%
11Racket 104.50104.5527,1921496  0% 0% 98% 2%
13Erlang HiPE #3 125.85125.8813,1441399  79% 21% 0% 0%
40Erlang #3 6 min6 min12,0281399  43% 8% 0% 49%
59Ruby JRuby #2 9 min9 min605,5241137  0% 0% 52% 48%
72Ruby 2.0 #2 11 min11 min6,1721137  99% 0% 1% 0%
82PHP #3 12 min12 min3,2681082  0% 0% 100% 0%
100Python 3 15 min15 min6,2921181  8% 74% 18% 0%
117Perl #2 18 min18 min2,6481401  0% 0% 0% 100%
"wrong" (different) algorithm / less comparable programs
1.0C++ g++ #2 9.789.798322288

 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