pidigits benchmark N=10,000

Each chart bar shows how many times more Memory, one ↓ pidigits program used, compared to the program that used least Memory.

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.

    sortsort sort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0Pascal Free Pascal 29.4429.468203042  99% 1% 1% 1%
1.3Pascal Free Pascal #2 2.792.791,044785  1% 1% 0% 100%
1.4Pascal Free Pascal #3 1.721.731,188482  1% 1% 100% 2%
1.9Fortran Intel #3 1.911.921,572975  0% 2% 100% 3%
1.9Fortran Intel #2 2.302.301,596934  1% 1% 100% 1%
2.4C gcc 1.721.731,996448  2% 1% 1% 100%
2.7C gcc #4 2.282.292,252541  1% 1% 100% 0%
4.2C++ g++ #3 2.292.293,440682  1% 100% 1% 0%
4.4Go #2 3.953.773,612674  69% 2% 5% 34%
4.4Go #4 4.103.873,620607  1% 1% 4% 100%
5.0PHP #4 2.232.234,060384  1% 0% 2% 100%
5.0PHP #5 2.222.234,064394  1% 0% 1% 100%
5.0PHP #3 2.322.334,108500  0% 0% 100% 1%
5.2Ada 2005 GNAT #2 2.292.294,2241254  1% 0% 7% 100%
5.3Ada 2005 GNAT 10.9810.994,3121143  0% 0% 100% 1%
5.4Perl #4 3.483.484,392261  1% 0% 100% 1%
5.4Perl #3 3.503.504,444301  0% 1% 2% 100%
5.5Perl #2 3.993.994,512385  0% 1% 100% 1%
5.5PHP #2 3.393.404,512537  1% 0% 100% 1%
7.7PHP 9 min9 min6,304736  30% 1% 71% 1%
8.1Perl 15.1015.106,632452  0% 0% 1% 100%
8.1Python 3 #2 2.412.416,680256  1% 100% 1% 1%
8.2Python 3 #5 2.212.216,744335  1% 100% 0% 1%
8.3Rust 1.731.736,7841420  1% 100% 1% 1%
11OCaml 2.832.839,192560  1% 0% 0% 100%
11Lisp SBCL 2.362.379,2801073  3% 1% 0% 100%
13Haskell GHC #4 3.972.7010,304341  18% 100% 17% 18%
34Erlang HiPE 17.2117.2228,116559  1% 4% 99% 1%
35Erlang 16.2116.2128,352559  1% 1% 1% 100%
36Erlang HiPE #2 16.4315.9429,812512  67% 32% 2% 3%
37Racket #2 2.322.3230,4481122  1% 1% 100% 0%
41Java  #2 3.223.1233,528938  3% 2% 80% 21%
46Erlang #2 16.2115.8137,764512  74% 2% 14% 14%
51Dart 22.0621.8941,536321  1% 100% 0% 1%
75Scala #4 3.532.9761,2721125  33% 3% 73% 11%
81C# Mono #2 38.4138.3066,408856  3% 1% 1% 97%
88Java  #4 7.293.5872,0161808  57% 44% 46% 53%
95Java  #3 6.783.5478,2281826  51% 45% 46% 47%
103Clojure #5 5.434.1984,5881944  64% 13% 47% 8%
104Hack 7 min7 min85,072735  1% 1% 54% 47%
145Lisp SBCL #2 21.7421.78118,492645  100% 0% 1% 1%
171Racket 23.2723.29140,200453  1% 2% 1% 100%
180Ruby #4 11.1911.22147,368240  1% 1% 100% 0%
180Ruby #3 11.1911.21147,748242  1% 0% 100% 1%
197Ruby 30.5530.61161,204518  1% 1% 100% 0%
464Java  18.1817.30380,352800  30% 25% 31% 21%
468Scala #3 15.5414.26383,440479  46% 11% 18% 36%
504Clojure #4 8.605.54413,0161794  40% 24% 79% 13%
505Clojure #2 23.0019.39414,268571  20% 28% 26% 47%
508Clojure #3 25.9220.46416,172482  22% 11% 29% 69%
802Ruby JRuby #4 18.1312.71657,412240  15% 79% 34% 16%
813Ruby JRuby #3 18.5412.70666,456242  18% 46% 66% 17%
894Ruby JRuby 28.4220.76733,468518  90% 22% 15% 12%
C# Mono #3 Failed1026
F# Mono #3 Failed903
F# Mono Failed513
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
494Scala #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