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.0Python 2 #4 0.020.02?378  33% 0% 100% 0%
1.0Python 2 #4 0.020.02?378  0% 33% 100% 0%
1.1Python 2 #4 0.020.03?378  0% 0% 100% 0%
1.2Python development version #4 0.020.03?379  0% 67% 0% 0%
1.2Python development version #4 0.020.03?379  75% 0% 0% 0%
1.3Python development version #4 0.030.03?379  33% 67% 0% 25%
1.4Python 3 #4 0.030.03?379  100% 0% 0% 0%
1.4Python 3 #4 0.030.03?379  100% 0% 25% 0%
1.5Python 3 #4 0.030.03?379  0% 0% 0% 100%
1.6Cython #4 0.030.04?379  0% 0% 100% 0%
1.7Cython #4 0.030.04?379  0% 0% 50% 100%
2.1Nuitka #4 0.050.05?379  0% 0% 0% 100%
2.1Nuitka #4 0.050.05?379  0% 100% 0% 0%
2.2Nuitka #4 0.050.05?379  0% 0% 0% 100%
2.3Cython #4 0.030.05?379  0% 57% 50% 0%
27PyPy 3 #4 0.620.6350,280379  3% 10% 100% 3%
28PyPy 3 #4 0.640.6450,368379  0% 3% 0% 100%
30PyPy 3 #4 0.650.6949,932379  71% 34% 0% 1%
30PyPy 2 #4 0.700.7091,360378  1% 3% 0% 100%
30PyPy 2 #4 0.700.7091,592378  1% 100% 7% 1%
31PyPy 2 #4 0.710.7191,048378  100% 1% 4% 0%
39Python development version #5 0.900.909,856672  0% 1% 100% 1%
39Python 3 #5 0.910.9110,944672  0% 100% 0% 0%
40Python 3 #5 0.910.9210,748672  1% 0% 100% 0%
40Nuitka #5 0.910.9212,276672  2% 2% 2% 100%
40Nuitka #5 0.920.9212,184672  100% 2% 2% 2%
41Nuitka #5 0.920.9412,352672  5% 96% 2% 1%
41Python 3 #5 0.920.9410,736672  3% 98% 1% 1%
41Python development version #5 0.940.949,880672  3% 100% 0% 11%
42Pyston 0.970.9827,908322  2% 0% 100% 1%
43Python development version #5 0.980.989,784672  100% 16% 13% 9%
43Pyston 0.980.9828,828322  2% 100% 0% 4%
43Nuitka #2 0.991.0012,028364  1% 3% 0% 100%
43Nuitka #2 0.991.0012,180364  5% 0% 2% 100%
44Nuitka #2 1.001.0111,772364  9% 100% 3% 2%
46Pyston 1.051.0636,552322  100% 1% 4% 4%
47Cython #2 1.071.0710,396364  1% 100% 1% 1%
47Cython #2 1.071.0810,556364  3% 4% 0% 100%
47Python 3 #2 1.081.0910,672364  1% 100% 1% 1%
47Cython #2 1.081.0910,408364  4% 0% 100% 2%
47Python 3 #2 1.081.0910,636364  1% 100% 1% 1%
48Python development version #2 1.091.099,656364  0% 4% 1% 100%
48Python 3 #2 1.101.1010,632364  2% 0% 100% 1%
48Python development version #2 1.081.119,588364  96% 4% 2% 1%
48Python 2 #2 1.111.127,404363  97% 11% 6% 9%
49Python development version #2 1.111.129,696364  100% 2% 2% 8%
49Python 2 #2 1.111.127,296363  2% 10% 100% 5%
56Python 2 #2 1.281.297,248363  100% 25% 19% 27%
87Nuitka #3 2.012.0112,000639  1% 0% 0% 100%
87Nuitka #3 2.012.0112,188639  1% 0% 100% 2%
89Nuitka #3 2.032.0412,124639  11% 2% 3% 100%
89Cython #3 2.042.0510,640639  3% 4% 3% 100%
89Python 3 #3 2.052.0610,960639  3% 1% 0% 100%
89Python 3 #3 2.052.0610,944639  1% 100% 3% 0%
90Python 3 #3 2.062.0611,004639  4% 0% 100% 0%
90Python 2 #3 2.072.077,560638  3% 2% 1% 100%
90Cython #3 2.072.0810,508639  3% 100% 25% 2%
91Cython #3 2.102.1010,600639  5% 5% 100% 5%
92Python development version #3 2.112.119,940639  7% 100% 6% 1%
92Python 2 #3 2.112.127,580638  7% 100% 4% 5%
93Python 2 #3 2.142.147,796638  100% 4% 8% 7%
95Python development version #3 2.182.199,900639  8% 8% 100% 7%
111Python development version #3 2.512.559,920639  55% 74% 40% 28%
146Nuitka 3.353.3510,828322  1% 100% 3% 2%
146Nuitka 3.353.3611,048322  4% 96% 1% 6%
146Nuitka 3.353.3610,968322  2% 4% 100% 2%
148Python 3 3.413.419,520322  100% 2% 1% 1%
148Python 3 3.413.419,480322  5% 3% 96% 1%
149Python 3 3.423.429,440322  0% 2% 1% 100%
162Python 2 3.723.736,784322  39% 3% 63% 2%
165PyPy 3 3.803.8046,140322  2% 100% 2% 2%
166Python 2 3.813.826,792322  8% 90% 14% 5%
166Python development version 3.823.838,352322  99% 5% 3% 4%
167PyPy 3 3.833.8446,040322  5% 100% 3% 4%
169PyPy 3 3.873.8846,128322  99% 5% 6% 2%
170Cython 3.913.929,152322  41% 11% 59% 9%
171Cython 3.933.939,128322  7% 7% 5% 100%
171PyPy 2 3.933.9476,088322  2% 1% 1% 100%
171Python development version 3.933.948,352322  21% 84% 6% 7%
171Python 2 3.943.946,784322  12% 8% 12% 100%
172Python development version 3.963.968,360322  6% 73% 7% 32%
173PyPy 2 3.973.9776,268322  2% 1% 100% 1%
173PyPy 2 3.973.9876,016322  3% 3% 100% 0%
186Cython 4.264.288,924322  86% 44% 19% 23%
330Jython 12.727.59283,068322  57% 45% 40% 36%
335Jython 13.137.71291,372322  44% 42% 51% 43%
336Jython 13.077.73282,640322  44% 51% 45% 38%
411MicroPython 9.469.464,192322  1% 1% 1% 100%
412MicroPython 9.479.484,208322  2% 1% 0% 100%
413MicroPython 9.499.494,120322  2% 1% 100% 0%
804IronPython 18.8118.4899,512322  5% 2% 3% 99%
804IronPython 18.8918.49102,160322  2% 4% 100% 5%
838IronPython 19.1619.2796,556322  6% 96% 4% 5%
missing benchmark programs
Shedskin No program
Numba No program
Grumpy No program

 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