pidigits benchmark N=10,000

Each chart bar shows how many times more Memory, one ↓ pidigits 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 41.3041.326523042  1% 0% 0% 100%
1.3Pascal Free Pascal #2 3.753.76852785  1% 100% 0% 1%
1.3C gcc 2.492.49856448  3% 100% 1% 0%
1.7C gcc #4 2.672.681,120541  0% 100% 0% 1%
2.2C++ g++ #3 2.682.681,452682  0% 0% 1% 100%
2.3Fortran Intel #2 2.742.741,476934  0% 0% 100% 1%
2.3Fortran Intel #3 2.862.861,476975  1% 0% 0% 100%
2.7Ada 2005 GNAT 3.763.761,7841143  1% 1% 100% 0%
2.7Ada 2005 GNAT #2 2.682.681,7841254  1% 0% 0% 100%
2.9OCaml #4 11.5511.561,9121481  1% 0% 0% 100%
5.2PHP #5 2.782.793,412394  0% 0% 1% 100%
5.3Go #4 7.507.193,480607  5% 5% 4% 100%
5.5Go #2 7.487.173,556674  1% 2% 100% 1%
5.5PHP #4 2.802.803,576384  0% 0% 1% 100%
5.5Perl #4 5.465.473,600261  0% 1% 100% 0%
5.6PHP #3 2.882.893,644500  0% 0% 1% 100%
5.6Perl #2 6.206.213,660385  0% 1% 0% 100%
6.0PHP #2 4.554.563,912537  0% 1% 1% 100%
6.9Rust 20.4420.464,496691  0% 0% 1% 100%
7.0OCaml #3 13.5113.524,548869  1% 0% 0% 100%
7.0OCaml #2 16.6016.624,572510  1% 74% 26% 0%
7.5Perl 17.1617.184,920452  0% 0% 2% 100%
7.6Python 3 13.4513.454,928242  2% 3% 1% 100%
8.2Python 3 #2 3.053.065,332256  1% 1% 0% 100%
8.2PHP 9 min9 min5,364736  88% 0% 0% 12%
8.4Python 3 #3 6.156.165,480521  0% 100% 1% 0%
8.7OCaml 3.803.815,700560  0% 0% 1% 100%
9.4Haskell GHC #4 4.953.496,152341  14% 15% 100% 13%
10Lisp SBCL 2.772.776,4761073  0% 2% 1% 100%
28Java  #2 4.154.0418,352938  16% 84% 1% 1%
28Racket #2 3.083.0918,4721122  0% 1% 100% 1%
29Erlang HiPE 24.6924.7018,836559  1% 69% 31% 0%
30C# Mono #3 3.983.9919,6361026  1% 99% 1% 1%
31F# Mono #3 3.963.9719,944903  1% 99% 1% 2%
33Erlang HiPE #2 24.1923.2021,200512  78% 0% 5% 22%
62Dart 39.5239.2740,396321  1% 0% 100% 1%
65Java  #4 13.144.7942,2121808  69% 65% 69% 74%
65Scala #4 4.593.9142,3641125  65% 6% 39% 9%
65Java  #3 12.884.7942,4361826  71% 66% 66% 69%
72C# Mono #2 58.9759.0346,996856  1% 100% 0% 1%
82F# Mono 76.7476.8253,464513  1% 54% 46% 1%
83Lisp SBCL #2 31.5531.6054,160645  0% 1% 1% 100%
101Clojure #5 6.565.2365,6041944  13% 92% 7% 16%
110Ruby #3 11.0711.0972,012242  1% 0% 1% 100%
111Ruby #4 11.0611.0872,388240  1% 1% 0% 100%
172Racket 28.2828.31112,068453  0% 0% 0% 100%
365Ruby 21.6221.66238,196518  1% 0% 100% 1%
567Java  27.0726.11369,760800  20% 32% 29% 25%
587Clojure #2 31.2127.52383,048571  27% 37% 25% 25%
593Clojure #3 34.2628.68386,548482  30% 28% 36% 27%
594Clojure #4 9.946.81387,2961794  21% 74% 10% 43%
933Ruby JRuby #4 21.0216.50608,068240  77% 13% 21% 18%
945Ruby JRuby #3 21.3916.50615,840242  17% 13% 70% 31%
981Ruby #5 3.994.00639,680478  2% 100% 16% 5%
992Ruby JRuby 36.2627.46646,964518  30% 31% 18% 56%
1,689Scala #3 28.3022.271,101,536479  50% 12% 12% 53%
Fortran Intel Bad Output1768
Perl #3 Bad Output301
Ruby #2 Failed653
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
568Scala #2 11.509.59370,132632

 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