/mobile Handheld Friendly website

 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.

    sort sortsort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0C gcc 1.731.73932448  1% 1% 3% 100%
1.1Fortran Intel #3 1.911.921,324975  0% 2% 1% 100%
1.2PHP #5 2.162.164,280394  1% 0% 0% 100%
1.3PHP #4 2.162.174,284384  0% 0% 1% 100%
1.3PHP #3 2.242.254,496500  0% 0% 0% 100%
1.3C gcc #4 2.292.29928541  1% 0% 0% 100%
1.3Ada 2005 GNAT #2 2.292.292,0801254  2% 0% 2% 100%
1.3C++ g++ #3 2.292.301,656682  1% 0% 0% 100%
1.3Fortran Intel #2 2.292.301,328934  0% 0% 2% 100%
1.4Racket #2 2.342.3425,6481122  0% 1% 0% 100%
1.4Lisp SBCL 2.372.375,7121073  1% 2% 5% 100%
1.4Python 3 #2 2.402.416,600256  1% 2% 0% 100%
1.6Haskell GHC #4 3.982.716,212341  17% 16% 100% 17%
1.6Pascal Free Pascal #2 2.782.781,024785  0% 0% 0% 100%
1.6OCaml 2.812.819,036560  0% 0% 100% 0%
1.7Scala #4 3.742.9944,8361125  10% 9% 99% 10%
1.8Java  #2 3.173.0323,504938  19% 80% 5% 3%
1.9Go #4 3.463.303,944607  2% 2% 100% 1%
2.0PHP #2 3.383.394,768537  1% 61% 40% 1%
2.4Clojure #5 5.574.2477,4681944  28% 62% 29% 15%
2.5Perl #4 4.374.384,316261  1% 0% 0% 100%
2.6Perl #3 4.464.474,316301  0% 100% 0% 0%
2.6Python 3 #3 4.534.546,788521  2% 1% 0% 100%
2.7Java  #4 12.714.7349,1361808  68% 68% 66% 69%
2.7Java  #3 12.714.7453,3721826  68% 67% 68% 69%
2.8Perl #2 4.924.924,396385  1% 100% 1% 0%
3.2Clojure #4 8.815.54209,3201794  56% 25% 23% 56%
3.6Python 3 6.156.156,040242  0% 0% 100% 1%
5.4OCaml #4 9.309.312,8361481  11% 0% 1% 89%
6.3Ada 2005 GNAT 10.8510.852,1601143  0% 1% 100% 0%
6.4C# Mono #3 10.9911.0016,3121026  0% 1% 100% 1%
6.4F# Mono #3 11.0111.0217,488903  100% 0% 1% 1%
6.5Ruby #4 11.1511.1775,236240  1% 1% 0% 100%
6.5Ruby #3 11.1611.1874,636242  1% 1% 0% 100%
7.2Rust 12.4912.501,620677  1% 100% 0% 0%
7.3Ruby JRuby #4 17.5912.66650,764240  77% 29% 18% 16%
7.3Ruby JRuby #3 17.8312.68644,196242  68% 16% 30% 28%
9.0Erlang HiPE #2 16.4715.5727,604512  1% 5% 99% 1%
9.1Erlang #2 16.0315.6833,568512  2% 1% 1% 99%
9.2Perl 15.8315.846,452452  0% 0% 100% 0%
9.3Erlang 16.1116.1221,152559  100% 0% 0% 0%
9.9Scala #3 24.1017.071,080,056479  19% 72% 35% 17%
10OCaml #3 17.2417.277,724869  7% 0% 100% 1%
10Erlang HiPE 17.5517.5525,368559  1% 10% 11% 79%
11Java  19.7218.43348,168800  23% 43% 25% 17%
11Lisp SBCL #2 18.6018.64216,844645  1% 0% 1% 100%
11Clojure #2 23.2719.67374,140571  15% 79% 14% 12%
12Ruby JRuby 29.5220.61751,600518  37% 11% 77% 19%
12Clojure #3 26.2920.67410,348482  20% 72% 17% 20%
13OCaml #2 22.0522.087,744510  0% 0% 100% 0%
16Dart 27.2327.0893,696321  1% 1% 1% 100%
16Racket 27.5227.55118,288453  1% 0% 100% 1%
17Pascal Free Pascal 29.4429.458243042  73% 0% 0% 28%
18Ruby 30.6530.70231,480518  0% 100% 1% 0%
23C# Mono #2 39.6139.6544,060856  97% 1% 1% 3%
32F# Mono 54.7954.8349,508513  97% 1% 2% 3%
264Hack 7 min7 min59,236735  1% 0% 100% 1%
312PHP 8 min8 min6,392736  0% 99% 1% 0%
Fortran Intel Failed1768
Ruby #2 Failed653
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
3.8Scala #2 8.366.64250,164632

 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