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.010.01?380  0% 0% 100% 0%
1.0Python 2 #4 0.010.01?380  0% 0% 0% 100%
1.4Python 2 #4 0.020.02?380  50% 0% 100% 0%
2.1Cython #4 0.030.03?349  0% 33% 100% 0%
2.1Cython #4 0.030.03?349  100% 0% 0% 0%
2.1Cython #4 0.030.03?349  100% 0% 0% 0%
2.6Python 3 #4 0.030.04?379  0% 40% 75% 50%
2.6Nuitka #4 0.040.04?379  100% 20% 0% 0%
2.6Nuitka #4 0.040.04?379  0% 100% 0% 0%
2.9Nuitka #4 0.040.04?379  0% 100% 25% 0%
3.1Python 3 #4 0.040.04?379  100% 0% 75% 20%
3.2Python 3 #4 0.040.05?379  60% 100% 80% 67%
65Pyston 0.900.9026,528322  1% 100% 0% 0%
65Pyston 0.910.9126,560322  0% 4% 95% 0%
65Pyston 0.910.9126,480322  100% 0% 0% 1%
68Nuitka #5 0.950.9612,480710  2% 100% 0% 0%
68Nuitka #5 0.950.9612,484710  0% 1% 100% 1%
69Nuitka #5 0.960.9612,308710  100% 1% 2% 1%
70Python 3 #5 0.980.9811,292710  2% 5% 100% 3%
71Python 3 #5 0.990.9911,172710  25% 6% 77% 4%
73Nuitka #2 1.021.0212,432389  0% 100% 1% 0%
73Python 2 #2 1.021.038,884389  100% 1% 2% 1%
74Python 3 #5 0.981.0311,296710  2% 100% 2% 5%
74Nuitka #2 1.021.0312,264389  3% 5% 1% 97%
74Python 2 #2 1.041.048,820389  2% 3% 100% 3%
75Nuitka #2 1.051.0512,284389  1% 100% 0% 2%
75Cython #2 1.051.0510,984364  1% 3% 1% 100%
76Cython #2 1.061.0611,036364  100% 3% 3% 1%
77Cython #2 1.071.0710,876364  6% 1% 98% 1%
77Python 2 #2 1.071.088,972389  7% 99% 8% 9%
77Python 3 #2 1.081.0810,956389  64% 13% 42% 6%
80Python 3 #2 1.071.1211,128389  6% 100% 1% 1%
81Python 3 #2 1.131.1411,152389  17% 18% 23% 100%
139Python 2 #3 1.941.948,972664  100% 3% 1% 1%
139Python 2 #3 1.941.949,020664  100% 2% 1% 2%
139Nuitka #3 1.941.9512,292664  100% 1% 2% 1%
139Python 2 #3 1.941.959,268664  1% 99% 2% 2%
139Cython #3 1.951.9511,276639  2% 1% 100% 2%
140Cython #3 1.951.9510,816639  99% 2% 2% 2%
140Cython #3 1.951.9511,008639  100% 1% 2% 1%
140Nuitka #3 1.951.9512,268664  2% 3% 2% 100%
140Nuitka #3 1.961.9612,160664  2% 100% 5% 3%
141Python 3 #3 1.961.9711,416664  100% 6% 3% 2%
147Python 3 #3 2.052.0611,384664  60% 12% 49% 8%
153Python 3 #3 2.132.1411,388664  13% 19% 15% 100%
207Python development version 2.902.908,624322  5% 64% 0% 37%
207Cython 2.902.909,500322  100% 1% 1% 0%
208Nuitka 2.902.9110,520322  1% 100% 0% 1%
208Nuitka 2.902.9110,532322  1% 1% 1% 100%
208Cython 2.902.919,344322  100% 0% 1% 0%
208Cython 2.902.919,488322  1% 100% 1% 1%
208Nuitka 2.902.9110,548322  67% 1% 34% 1%
210Python development version 2.942.958,448322  6% 2% 100% 1%
211Python development version 2.942.968,676322  15% 2% 91% 1%
215Python 3 3.003.019,408322  56% 16% 52% 9%
216PyPy 2 3.003.0385,776322  6% 11% 99% 8%
225PyPy 2 3.083.1586,036322  10% 17% 100% 10%
225Python 3 3.063.159,320322  14% 59% 39% 25%
229Python 2 3.203.207,236322  8% 3% 7% 100%
232Python 2 3.243.257,216322  9% 100% 6% 7%
234Python 3 3.163.279,468322  21% 65% 59% 20%
238PyPy 2 3.323.3486,360322  32% 32% 31% 92%
242Python 2 3.383.397,468322  44% 14% 16% 73%
252RustPython 3.523.5220,664322  8% 32% 3% 70%
252RustPython 3.523.5220,400322  8% 12% 3% 91%
259PyPy 3 3.593.6379,088322  98% 75% 45% 52%
260PyPy 3 3.533.6479,024322  49% 77% 89% 59%
266PyPy 3 3.543.7379,340322  70% 97% 68% 39%
292RustPython 3.974.0820,344322  45% 30% 81% 26%
386Jython 8.845.40290,952322  34% 45% 51% 35%
389Jython 8.865.44294,580322  29% 51% 30% 54%
402Jython 9.425.63324,056322  47% 39% 41% 40%
906IronPython 13.1212.6877,680322  58% 2% 41% 2%
906IronPython 13.1512.6979,276322  1% 29% 5% 68%
906IronPython 13.1412.6978,604322  0% 57% 3% 42%
931MicroPython 12.8613.034,248322  10% 33% 10% 79%
940MicroPython 13.1213.174,220322  33% 35% 20% 84%
1,126MicroPython 15.2615.764,260322  95% 82% 73% 77%
missing benchmark programs
Shedskin No program
Numba No program
Grumpy No program
Graal 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