/mobile Handheld Friendly website

 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.0611.0872,388240  1% 1% 0% 100%
1.0Ruby JRuby #4 21.0216.50608,068240  77% 13% 21% 18%
1.0Ruby JRuby #3 21.3916.50615,840242  17% 13% 70% 31%
1.0Python 3 13.4513.454,928242  2% 3% 1% 100%
1.0Ruby #3 11.0711.0972,012242  1% 0% 1% 100%
1.1Python 3 #2 3.053.065,332256  1% 1% 0% 100%
1.1Perl #4 5.465.473,600261  0% 1% 100% 0%
1.3Dart 43.0042.7280,340321  1% 0% 100% 1%
1.4Haskell GHC #4 4.953.496,152341  14% 15% 100% 13%
1.6PHP #4 2.802.803,576384  0% 0% 1% 100%
1.6Perl #2 6.206.213,660385  0% 1% 0% 100%
1.6PHP #5 2.782.793,412394  0% 0% 1% 100%
1.9C gcc 2.502.50868448  0% 4% 100% 0%
1.9Perl 17.1617.184,920452  0% 0% 2% 100%
1.9Racket 28.2828.31112,068453  0% 0% 0% 100%
2.0Scala #3 28.3022.271,101,536479  50% 12% 12% 53%
2.0Clojure #3 34.2628.68386,548482  30% 28% 36% 27%
2.1PHP #3 2.882.893,644500  0% 0% 1% 100%
2.1OCaml #2 16.6016.624,572510  1% 74% 26% 0%
2.1Erlang HiPE #2 24.1923.2021,200512  78% 0% 5% 22%
2.1F# Mono 79.8179.8948,372513  97% 1% 2% 2%
2.2Ruby 21.6221.66238,196518  1% 0% 100% 1%
2.2Ruby JRuby 36.2627.46646,964518  30% 31% 18% 56%
2.2Python 3 #3 6.156.165,480521  0% 100% 1% 0%
2.2PHP #2 4.554.563,912537  0% 1% 1% 100%
2.3C gcc #4 2.682.681,132541  1% 1% 0% 100%
2.3Erlang HiPE 24.6924.7018,836559  1% 69% 31% 0%
2.3OCaml 3.803.815,700560  0% 0% 1% 100%
2.4Clojure #2 31.2127.52383,048571  27% 37% 25% 25%
2.5Go #4 7.356.903,216607  1% 2% 3% 100%
2.7Lisp SBCL #2 32.5532.6150,292645  1% 0% 100% 0%
2.8Rust 63.7563.781,676677  0% 1% 1% 100%
2.8C++ g++ #3 2.682.681,464682  1% 0% 2% 100%
3.1PHP 9 min9 min5,364736  88% 0% 0% 12%
3.3Pascal Free Pascal #2 3.763.76856785  0% 100% 1% 1%
3.3Java  27.0726.11369,760800  20% 32% 29% 25%
3.6C# Mono #2 58.4358.4944,088856  1% 17% 83% 1%
3.6OCaml #3 13.5113.524,548869  1% 0% 0% 100%
3.8F# Mono #3 3.953.9516,128903  0% 1% 100% 2%
3.9Fortran Intel #2 2.742.741,476934  0% 0% 100% 1%
3.9Java  #2 4.154.0418,352938  16% 84% 1% 1%
4.1Fortran Intel #3 2.862.861,476975  1% 0% 0% 100%
4.3C# Mono #3 3.943.9515,3601026  99% 1% 2% 1%
4.5Lisp SBCL 2.772.774,6441073  0% 0% 1% 100%
4.7Racket #2 3.083.0918,4721122  0% 1% 100% 1%
4.7Scala #4 4.593.9142,3641125  65% 6% 39% 9%
4.8Ada 2005 GNAT 3.763.771,8081143  1% 1% 100% 1%
5.2Ada 2005 GNAT #2 2.682.682,0721254  0% 1% 100% 1%
6.2OCaml #4 11.5511.561,9121481  1% 0% 0% 100%
7.5Clojure #4 9.946.81387,2961794  21% 74% 10% 43%
7.5Java  #4 13.144.7942,2121808  69% 65% 69% 74%
7.6Java  #3 12.884.7942,4361826  71% 66% 66% 69%
13Pascal Free Pascal 41.3441.356523042  100% 0% 0% 0%
Clojure #5 Bad Output1939
Fortran Intel Bad Output1768
Perl #3 Bad Output301
Ruby #2 Failed653
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
2.6Scala #2 11.509.59370,132632

 pidigits benchmark : Streaming arbitrary-precision arithmetic

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