pidigits benchmark N=10,000

Each chart bar shows how many times slower, one ↓ pidigits 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.

     sortsortsort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0C gcc 1.721.731,996448  2% 1% 1% 100%
1.0Pascal Free Pascal #3 1.721.731,188482  1% 1% 100% 2%
1.0Rust 1.731.736,7841420  1% 100% 1% 1%
1.1Fortran Intel #3 1.911.921,572975  0% 2% 100% 3%
1.3Python 3 #5 2.212.216,744335  1% 100% 0% 1%
1.3PHP #5 2.222.234,064394  1% 0% 1% 100%
1.3PHP #4 2.232.234,060384  1% 0% 2% 100%
1.3C gcc #4 2.282.292,252541  1% 1% 100% 0%
1.3Ada 2005 GNAT #2 2.292.294,2241254  1% 0% 7% 100%
1.3C++ g++ #3 2.292.293,440682  1% 100% 1% 0%
1.3Fortran Intel #2 2.302.301,596934  1% 1% 100% 1%
1.3Racket #2 2.322.3230,4481122  1% 1% 100% 0%
1.3PHP #3 2.322.334,108500  0% 0% 100% 1%
1.4Lisp SBCL 2.362.379,2801073  3% 1% 0% 100%
1.4Python 3 #2 2.412.416,680256  1% 100% 1% 1%
1.6Pascal Free Pascal #2 2.792.791,044785  1% 1% 0% 100%
1.6OCaml 2.832.839,192560  1% 0% 0% 100%
1.9Java  #2 3.223.1233,528938  3% 2% 80% 21%
2.0PHP #2 3.393.404,512537  1% 0% 100% 1%
2.0Perl #4 3.483.484,392261  1% 0% 100% 1%
2.0Perl #3 3.503.504,444301  0% 1% 2% 100%
2.0Scala #4 3.532.9761,2721125  33% 3% 73% 11%
2.3Go #2 3.953.773,612674  69% 2% 5% 34%
2.3Haskell GHC #4 3.972.7010,304341  18% 100% 17% 18%
2.3Perl #2 3.993.994,512385  0% 1% 100% 1%
2.4Go #4 4.103.873,620607  1% 1% 4% 100%
3.2Clojure #5 5.434.1984,5881944  64% 13% 47% 8%
3.9Java  #3 6.783.5478,2281826  51% 45% 46% 47%
4.2Java  #4 7.293.5872,0161808  57% 44% 46% 53%
5.0Clojure #4 8.605.54413,0161794  40% 24% 79% 13%
6.4Ada 2005 GNAT 10.9810.994,3121143  0% 0% 100% 1%
6.5Ruby #3 11.1911.21147,748242  1% 0% 100% 1%
6.5Ruby #4 11.1911.22147,368240  1% 1% 100% 0%
8.8Perl 15.1015.106,632452  0% 0% 1% 100%
9.0Scala #3 15.5414.26383,440479  46% 11% 18% 36%
9.4Erlang 16.2116.2128,352559  1% 1% 1% 100%
9.4Erlang #2 16.2115.8137,764512  74% 2% 14% 14%
9.5Erlang HiPE #2 16.4315.9429,812512  67% 32% 2% 3%
10Erlang HiPE 17.2117.2228,116559  1% 4% 99% 1%
11Ruby JRuby #4 18.1312.71657,412240  15% 79% 34% 16%
11Java  18.1817.30380,352800  30% 25% 31% 21%
11Ruby JRuby #3 18.5412.70666,456242  18% 46% 66% 17%
13Lisp SBCL #2 21.7421.78118,492645  100% 0% 1% 1%
13Dart 22.0621.8941,536321  1% 100% 0% 1%
13Clojure #2 23.0019.39414,268571  20% 28% 26% 47%
13Racket 23.2723.29140,200453  1% 2% 1% 100%
15Clojure #3 25.9220.46416,172482  22% 11% 29% 69%
16Ruby JRuby 28.4220.76733,468518  90% 22% 15% 12%
17Pascal Free Pascal 29.4429.468203042  99% 1% 1% 1%
18Ruby 30.5530.61161,204518  1% 1% 100% 0%
22C# Mono #2 38.4138.3066,408856  3% 1% 1% 97%
277Hack 7 min7 min126,972735  18% 0% 30% 54%
320PHP 9 min9 min6,304736  30% 1% 71% 1%
C# Mono #3 Failed1026
F# Mono #3 Failed903
F# Mono Failed513
Fortran Intel Failed1768
OCaml #2 Make Error510
OCaml #4 Make Error1481
OCaml #3 Make Error869
Ruby #2 Failed653
Ruby #5 Failed478
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
5.5Scala #2 9.416.62405,368632

 pidigits benchmark : Streaming arbitrary-precision arithmetic

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

More specifically:

diff program output N = 27 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 use the same step-by-step spigot algorithm to calculate digits of Pi.

Each program should

Programs should adapt the step-by-step algorithm given on pages 4,6 & 7 of Unbounded Spigot Algorithms for the Digits of Pi (156KB pdf). (Not the deliberately obscure version given on page 2.)(Not the Rabinowitz-Wagon algorithm.)

In addition to language specific multiprecision arithmetic, we will accept programs that use GMP.

For more information see Eric W. Weisstein, "Pi Digits." From MathWorld--A Wolfram Web Resource.
http://mathworld.wolfram.com/PiDigits.html

Revised BSD license

  Home   Conclusions   License   Play