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.0Pascal Free Pascal #3 1.721.731,188482  1% 1% 100% 2%
1.0C gcc 1.721.731,996448  2% 1% 1% 100%
1.0Rust 1.731.736,7761420  0% 99% 1% 1%
1.1Fortran Intel #3 1.911.921,572975  0% 2% 100% 3%
1.3Python 3 #5 2.212.216,744335  1% 100% 0% 1%
1.3PHP #5 2.222.234,064394  1% 0% 1% 100%
1.3PHP #4 2.232.234,060384  1% 0% 2% 100%
1.3C gcc #4 2.282.292,252541  1% 1% 100% 0%
1.3C++ g++ #3 2.292.293,440682  1% 100% 1% 0%
1.3Ada 2005 GNAT #2 2.292.294,2241254  1% 0% 7% 100%
1.3Fortran Intel #2 2.302.301,596934  1% 1% 100% 1%
1.3Racket #2 2.322.3230,4481122  1% 1% 100% 0%
1.3PHP #3 2.322.334,108500  0% 0% 100% 1%
1.4Lisp SBCL 2.362.379,2801073  3% 1% 0% 100%
1.4Python 3 #2 2.412.416,680256  1% 100% 1% 1%
1.6Pascal Free Pascal #2 2.792.791,044785  1% 1% 0% 100%
1.6OCaml 2.832.839,192560  1% 0% 0% 100%
1.9Java  #2 3.223.1233,528938  3% 2% 80% 21%
2.0PHP #2 3.393.404,512537  1% 0% 100% 1%
2.0Perl #4 3.483.484,392261  1% 0% 100% 1%
2.0Perl #3 3.503.504,444301  0% 1% 2% 100%
2.0Scala #4 3.532.9761,2721125  33% 3% 73% 11%
2.3Go #2 3.953.773,612674  69% 2% 5% 34%
2.3Haskell GHC #4 3.972.7010,304341  18% 100% 17% 18%
2.3Perl #2 3.993.994,512385  0% 1% 100% 1%
2.4Go #4 4.103.873,620607  1% 1% 4% 100%
3.4Clojure #5 5.804.2792,7001944  8% 11% 19% 100%
3.9Java  #3 6.783.5478,2281826  51% 45% 46% 47%
4.2Java  #4 7.293.5872,0161808  57% 44% 46% 53%
4.7Clojure #4 8.145.59416,2681794  50% 20% 33% 45%
6.4Ada 2005 GNAT 10.9810.994,3121143  0% 0% 100% 1%
6.5Ruby #3 11.1911.21147,748242  1% 0% 100% 1%
6.5Ruby #4 11.1911.22147,368240  1% 1% 100% 0%
6.5F# Mono #3 11.2011.2042,492903  1% 100% 1% 4%
6.5C# Mono #3 11.2211.2341,4081026  1% 100% 1% 0%
6.6Dart 11.4311.3344,348321  2% 0% 99% 1%
8.8Perl 15.1015.106,632452  0% 0% 1% 100%
9.0Scala #3 15.5414.26383,440479  46% 11% 18% 36%
9.5Erlang 16.3616.2832,948559  96% 1% 4% 1%
9.7Erlang #2 16.7415.8238,600512  13% 22% 25% 47%
10Erlang HiPE #2 17.3215.8936,164512  82% 14% 8% 7%
10Erlang HiPE 17.4017.3133,756559  1% 1% 7% 93%
11Ruby JRuby #4 18.1312.71657,412240  15% 79% 34% 16%
11Java  18.1817.30380,352800  30% 25% 31% 21%
11Ruby JRuby #3 18.5412.70666,456242  18% 46% 66% 17%
13Lisp SBCL #2 21.7421.78118,492645  100% 0% 1% 1%
13Clojure #2 21.9718.54412,108571  36% 17% 28% 40%
13Racket 23.2723.29140,200453  1% 2% 1% 100%
15Clojure #3 25.9819.83420,752482  24% 40% 36% 33%
16Ruby JRuby 28.4220.76733,468518  90% 22% 15% 12%
17Pascal Free Pascal 29.4429.468203042  99% 1% 1% 1%
18Ruby 30.5530.61161,204518  1% 1% 100% 0%
22C# Mono #2 38.4938.3867,404856  1% 1% 88% 12%
24F# Mono 40.7240.5880,508513  66% 34% 1% 1%
281Hack 8 min8 min129,820735  22% 16% 6% 58%
320PHP 9 min9 min6,304736  30% 1% 71% 1%
Fortran Intel Failed1768
OCaml #2 Make Error510
OCaml #4 Make Error1481
OCaml #3 Make Error869
Ruby #2 Failed653
Ruby #5 Failed478
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
5.5Scala #2 9.416.62405,368632

 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