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 2.492.49856448  3% 100% 1% 0%
1.0Rust #2 2.502.505,1841297  1% 1% 100% 1%
1.1C gcc #4 2.672.681,120541  0% 100% 0% 1%
1.1Ada 2005 GNAT #2 2.682.681,7841254  1% 0% 0% 100%
1.1C++ g++ #3 2.682.681,452682  0% 0% 1% 100%
1.1Fortran Intel #2 2.742.741,476934  0% 0% 100% 1%
1.1Lisp SBCL 2.782.788,6041073  0% 1% 0% 100%
1.1PHP #5 2.782.793,412394  0% 0% 1% 100%
1.1PHP #4 2.802.803,576384  0% 0% 1% 100%
1.1Fortran Intel #3 2.862.861,476975  1% 0% 0% 100%
1.2PHP #3 2.882.893,644500  0% 0% 1% 100%
1.2Python 3 #2 3.053.065,332256  1% 1% 0% 100%
1.2Racket #2 3.083.0918,4721122  0% 1% 100% 1%
1.5Pascal Free Pascal #2 3.753.76852785  1% 100% 0% 1%
1.5Ada 2005 GNAT 3.763.761,7841143  1% 1% 100% 0%
1.5OCaml 3.803.815,700560  0% 0% 1% 100%
1.6F# Mono #3 3.963.9719,944903  1% 99% 1% 2%
1.6C# Mono #3 3.983.9919,6361026  1% 99% 1% 1%
1.7Java  #2 4.154.0423,488938  2% 2% 0% 100%
1.8Scala #4 4.543.9045,4681125  57% 10% 45% 6%
1.8PHP #2 4.554.563,912537  0% 1% 1% 100%
2.0Haskell GHC #4 4.953.496,152341  14% 15% 100% 13%
2.2Perl #4 5.465.473,600261  0% 1% 100% 0%
2.5Python 3 #3 6.156.165,480521  0% 100% 1% 0%
2.5Perl #2 6.206.213,660385  0% 1% 0% 100%
2.7Clojure #5 6.625.2466,1441944  8% 11% 35% 75%
3.3Go #2 8.127.603,564674  0% 5% 2% 100%
3.3Go #4 8.187.643,552607  4% 2% 100% 2%
3.5Java  #3 8.774.3647,0961826  52% 52% 47% 48%
4.0Clojure #4 9.986.66392,1281794  61% 49% 25% 18%
4.5Ruby #3 11.3111.3373,884242  1% 1% 1% 100%
4.6Ruby #4 11.3211.3473,384240  0% 1% 1% 100%
4.6OCaml #4 11.5511.561,9121481  1% 0% 0% 100%
5.0Java  #4 12.474.6447,0241808  69% 67% 67% 67%
5.4Python 3 13.4513.454,928242  2% 3% 1% 100%
5.4OCaml #3 13.5113.524,548869  1% 0% 0% 100%
6.0Erlang HiPE 14.9414.9425,040559  1% 1% 1% 100%
6.4Erlang HiPE #2 15.8414.9530,204512  35% 21% 2% 51%
6.7OCaml #2 16.6016.624,572510  1% 74% 26% 0%
6.9Perl 17.1617.184,920452  0% 0% 2% 100%
8.1Rust 20.1720.184,744691  1% 100% 1% 2%
8.6Ruby JRuby #4 21.3416.47630,356240  10% 85% 25% 11%
8.7Ruby JRuby #3 21.7616.42635,540242  14% 14% 11% 95%
8.9Ruby 22.1122.15101,848518  0% 1% 1% 100%
9.0Scala #3 22.3020.48374,440479  61% 13% 10% 27%
11Java  26.4625.41376,628800  31% 30% 20% 25%
11Racket 28.2828.31112,068453  0% 0% 0% 100%
12Clojure #2 30.2826.53388,440571  32% 30% 42% 12%
13Lisp SBCL #2 31.6631.7056,112645  0% 0% 100% 1%
13Clojure #3 32.4327.30393,932482  44% 16% 28% 33%
14Ruby JRuby 34.6127.60648,000518  17% 26% 10% 75%
16Dart 38.8538.6020,936321  1% 1% 100% 1%
17Pascal Free Pascal 41.3041.326523042  1% 0% 0% 100%
24C# Mono #2 58.9759.0346,996856  1% 100% 0% 1%
31F# Mono 76.7476.8253,464513  1% 54% 46% 1%
224PHP 9 min9 min5,364736  88% 0% 0% 12%
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
4.5Scala #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