pidigits benchmark N=10,000

Each chart bar shows how many times more Code, one ↓ pidigits program used, compared to the program that used least Code.

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.0Ruby #4 11.2011.22147,624240  82% 1% 19% 1%
1.0Ruby JRuby #4 23.4617.21633,628240  66% 32% 19% 21%
1.0Python 3 13.4513.454,928242  2% 3% 1% 100%
1.0Ruby JRuby #3 23.5317.05637,144242  64% 38% 20% 19%
1.0Ruby #3 11.2611.28149,512242  1% 1% 0% 100%
1.1Python 3 #2 3.053.065,332256  1% 1% 0% 100%
1.1Perl #4 4.494.503,684261  1% 0% 1% 100%
1.3Dart 38.9438.6350,424321  1% 100% 1% 1%
1.4Python 3 #5 2.742.745,388335  0% 100% 1% 0%
1.4Haskell GHC #4 4.913.4812,272341  100% 14% 15% 14%
1.6PHP #4 2.862.873,436384  0% 100% 1% 1%
1.6Perl #2 5.145.143,760385  1% 0% 100% 1%
1.6PHP #5 2.852.863,412394  1% 100% 0% 1%
1.9C gcc 2.492.49856448  3% 100% 1% 0%
1.9Perl 16.4116.424,980452  1% 0% 1% 100%
1.9Racket 28.2828.31112,068453  0% 0% 0% 100%
2.0Scala #3 22.3020.48374,440479  61% 13% 10% 27%
2.0Clojure #3 32.4327.30393,932482  44% 16% 28% 33%
2.1PHP #3 2.942.953,412500  0% 100% 1% 1%
2.1Erlang HiPE #2 15.8414.9530,204512  35% 21% 2% 51%
2.1F# Mono 76.7476.8253,464513  1% 54% 46% 1%
2.2Ruby 21.4421.48156,764518  1% 1% 100% 0%
2.2Ruby JRuby 40.6528.32646,636518  18% 65% 43% 19%
2.2Python 3 #3 6.156.165,480521  0% 100% 1% 0%
2.2PHP #2 4.584.593,728537  1% 1% 0% 100%
2.3C gcc #4 2.672.681,120541  0% 100% 0% 1%
2.3Erlang HiPE 14.9414.9425,040559  1% 1% 1% 100%
2.3OCaml 3.843.847,024560  0% 1% 100% 1%
2.4Clojure #2 30.2826.53388,440571  32% 30% 42% 12%
2.5Go #4 8.187.643,552607  4% 2% 100% 2%
2.7Lisp SBCL #2 31.6631.7056,112645  0% 0% 100% 1%
2.8Go #2 8.127.603,564674  0% 5% 2% 100%
2.8C++ g++ #3 2.682.681,452682  0% 0% 1% 100%
3.1PHP 9 min9 min5,388736  9% 89% 3% 1%
3.3Pascal Free Pascal #2 3.753.76852785  1% 100% 0% 1%
3.3Java  26.4625.41376,628800  31% 30% 20% 25%
3.6C# Mono #2 58.9759.0346,996856  1% 100% 0% 1%
3.8F# Mono #3 3.963.9719,944903  1% 99% 1% 2%
3.9Fortran Intel #2 2.662.661,464934  0% 1% 100% 0%
3.9Java  #2 4.154.0423,488938  2% 2% 0% 100%
4.1Fortran Intel #3 2.662.671,200975  0% 1% 0% 100%
4.3C# Mono #3 3.983.9919,6361026  1% 99% 1% 1%
4.5Lisp SBCL 2.782.788,6041073  0% 1% 0% 100%
4.7Racket #2 3.083.0918,4721122  0% 1% 100% 1%
4.7Scala #4 4.543.9045,4681125  57% 10% 45% 6%
4.8Ada 2005 GNAT 3.763.761,7841143  1% 1% 100% 0%
5.2Ada 2005 GNAT #2 2.682.681,7841254  1% 0% 0% 100%
5.5Rust 2.492.495,3561326  0% 0% 2% 100%
7.5Clojure #4 9.986.66392,1281794  61% 49% 25% 18%
7.5Java  #4 12.474.6447,0241808  69% 67% 67% 67%
7.6Java  #3 8.774.3647,0961826  52% 52% 47% 48%
8.1Clojure #5 6.625.2466,1441944  8% 11% 35% 75%
13Pascal Free Pascal 41.3041.326523042  1% 0% 0% 100%
Fortran Intel Failed1768
OCaml #2 Make Error510
OCaml #3 Make Error869
OCaml #4 Make Error1481
Perl #3 Bad Output301
Ruby #2 Failed653
Ruby #5 Failed478
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
2.6Scala #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