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.

     sortsortsort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0C gcc 2.492.49856448  0% 1% 0% 100%
1.0Rust #2 2.502.505,1881297  1% 1% 2% 100%
1.0Lua #5 2.512.521,460479  0% 1% 1% 100%
1.1C gcc #4 2.672.681,116541  0% 0% 1% 100%
1.1C++ g++ #3 2.682.681,452682  0% 1% 4% 100%
1.1Ada 2005 GNAT #2 2.682.681,7841254  3% 1% 1% 100%
1.1Fortran Intel #2 2.742.741,476934  0% 1% 1% 100%
1.1Lisp SBCL 2.772.778,6041073  1% 0% 1% 100%
1.1PHP #5 2.782.783,588394  0% 0% 1% 100%
1.1Lua #3 2.782.791,596414  0% 1% 1% 100%
1.1PHP #4 2.802.803,580384  1% 1% 2% 100%
1.1Fortran Intel #3 2.852.861,476975  0% 1% 0% 100%
1.2PHP #3 2.882.883,640500  0% 0% 0% 100%
1.2Haskell GHC #4 2.962.965,676341  0% 1% 0% 100%
1.2Python 3 #2 3.043.055,312256  1% 0% 0% 100%
1.2Racket #2 3.083.0918,4601122  0% 2% 1% 100%
1.5Pascal Free Pascal #2 3.753.75852785  1% 0% 1% 100%
1.5Ada 2005 GNAT 3.753.761,7841143  5% 0% 1% 100%
1.5OCaml 3.803.815,700560  1% 0% 1% 100%
1.6F# Mono #3 3.963.9719,940903  2% 1% 1% 100%
1.6C# Mono #3 3.983.9819,6361026  1% 1% 1% 100%
1.6Lua 4.004.001,508522  0% 1% 0% 100%
1.7Java  #2 4.144.1421,844938  1% 0% 1% 100%
1.8Scala #4 4.434.4447,1081125  0% 1% 1% 100%
1.8PHP #2 4.554.563,912537  0% 0% 0% 100%
2.1Perl #4 5.235.243,296261  1% 0% 0% 100%
2.2Lua #7 5.515.521,464477  0% 1% 0% 100%
2.4Perl #2 5.945.943,368385  0% 0% 0% 100%
2.5Python 3 #3 6.146.155,476521  0% 1% 1% 100%
2.6Clojure #5 6.526.5366,3841944  1% 1% 2% 100%
3.1Java  #3 7.607.6149,0921826  1% 1% 1% 100%
3.1Go #2 7.647.653,556674  1% 1% 1% 100%
3.1Go #4 7.727.723,540607  1% 1% 0% 100%
3.1Java  #4 7.747.7547,7921808  1% 1% 0% 100%
3.8Clojure #4 9.509.51392,6041794  0% 1% 1% 100%
4.5Ruby #4 11.2711.2973,448240  0% 1% 1% 100%
4.5Ruby #3 11.2811.3073,864242  0% 1% 1% 100%
4.6OCaml #4 11.5411.551,9121481  0% 0% 1% 100%
5.4Python 3 13.4513.464,888242  1% 0% 1% 100%
5.5OCaml #3 13.6013.624,536869  0% 0% 0% 100%
6.6Perl 16.3016.324,488452  0% 0% 0% 100%
7.0OCaml #2 17.5317.554,372510  0% 0% 0% 100%
8.4Ruby JRuby #4 20.8620.90633,364240  0% 1% 1% 100%
8.4Rust 20.9620.984,796691  1% 0% 0% 100%
8.6Ruby JRuby #3 21.2921.33637,664242  0% 1% 1% 100%
8.8Ruby 22.0122.05101,884518  0% 1% 1% 100%
8.9Scala #3 22.0522.09375,060479  1% 1% 0% 100%
9.3Erlang HiPE #2 23.2323.2615,100512  0% 0% 0% 100%
10Erlang HiPE 24.8224.8518,260559  0% 0% 0% 100%
11Java  26.4026.44376,036800  2% 1% 1% 100%
11Smalltalk VisualWorks #4 27.2827.30177,184652  0% 0% 0% 100%
11Racket 27.8927.93112,584453  0% 1% 1% 100%
12Clojure #2 29.8629.91389,276571  1% 1% 0% 100%
13Lisp SBCL #2 31.6631.7056,112645  0% 1% 1% 100%
13Clojure #3 32.4832.53393,416482  1% 2% 1% 100%
15Ruby JRuby 37.0237.08676,152518  0% 1% 1% 100%
17Pascal Free Pascal 41.2941.306483042  1% 0% 0% 100%
24C# Mono #2 59.0659.1445,336856  1% 1% 1% 100%
25Dart 61.6961.7646,876321  0% 1% 1% 100%
31F# Mono 76.8876.9953,468513  0% 1% 1% 100%
98Lua #2 243.95244.011,3721144  0% 0% 0% 100%
224PHP 9 min9 min5,620736  1% 0% 0% 100%
C CINT #4 Failed541
Fortran Intel Bad Output1768
Perl #3 Bad Output301
Ruby #2 Failed653
Ruby #5 Failed478
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
0.4Lua #8 0.970.971,204609
4.4Scala #2 11.0011.02375,324632
55Lua #4 135.66135.701,304745
missing benchmark programs
JavaScript V8 No program

 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