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 #2 2.682.681,7841254  1% 0% 0% 100%
2.7Ada 2005 GNAT 3.763.761,7841143  1% 1% 100% 0%
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%
7.0OCaml #3 13.5113.524,548869  1% 0% 0% 100%
7.0OCaml #2 16.6016.624,572510  1% 74% 26% 0%
7.3Rust 20.1720.184,744691  1% 100% 1% 2%
7.5Perl 17.1617.184,920452  0% 0% 2% 100%
7.6Python 3 13.4513.454,928242  2% 3% 1% 100%
8.0Rust #2 2.502.505,1841297  1% 1% 100% 1%
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%
13Lisp SBCL 2.782.788,6041073  0% 1% 0% 100%
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%
36Java  #2 4.154.0423,488938  2% 2% 0% 100%
70Scala #4 4.543.9045,4681125  57% 10% 45% 6%
72C# Mono #2 58.9759.0346,996856  1% 100% 0% 1%
72Java  #4 12.474.6447,0241808  69% 67% 67% 67%
72Java  #3 8.774.3647,0961826  52% 52% 47% 48%
74Dart 61.8861.4848,184321  1% 1% 100% 1%
82F# Mono 76.7476.8253,464513  1% 54% 46% 1%
86Lisp SBCL #2 31.6631.7056,112645  0% 0% 100% 1%
101Clojure #5 6.625.2466,1441944  8% 11% 35% 75%
113Ruby #4 11.3211.3473,384240  0% 1% 1% 100%
113Ruby #3 11.3111.3373,884242  1% 1% 1% 100%
156Ruby 22.1122.15101,848518  0% 1% 1% 100%
172Racket 28.2828.31112,068453  0% 0% 0% 100%
574Scala #3 22.3020.48374,440479  61% 13% 10% 27%
578Java  26.4625.41376,628800  31% 30% 20% 25%
596Clojure #2 30.2826.53388,440571  32% 30% 42% 12%
601Clojure #4 9.986.66392,1281794  61% 49% 25% 18%
604Clojure #3 32.4327.30393,932482  44% 16% 28% 33%
967Ruby JRuby #4 21.3416.47630,356240  10% 85% 25% 11%
975Ruby JRuby #3 21.7616.42635,540242  14% 14% 11% 95%
994Ruby JRuby 34.6127.60648,000518  17% 26% 10% 75%
Fortran Intel Bad Output1768
Perl #3 Bad Output301
Ruby #2 Failed653
Ruby #5 Failed478
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
575Scala #2 11.229.25374,612632

 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