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 2.482.491,124482  0% 2% 100% 2%
1.0Rust 2.492.496,6641420  1% 2% 100% 1%
1.0C gcc 2.492.502,140448  100% 0% 1% 0%
1.1Fortran Intel #2 2.662.661,464934  0% 1% 100% 0%
1.1Fortran Intel #3 2.662.671,200975  0% 1% 0% 100%
1.1Ada 2005 GNAT #2 2.682.683,8201254  100% 0% 1% 1%
1.1C gcc #4 2.682.682,104541  1% 66% 34% 1%
1.1C++ g++ #3 2.682.693,076682  0% 1% 2% 100%
1.1Python 3 #5 2.742.745,400335  0% 1% 100% 0%
1.1Lisp SBCL 2.772.788,4961073  2% 0% 0% 100%
1.1PHP #5 2.852.863,412394  1% 100% 0% 1%
1.2PHP #4 2.862.873,436384  0% 100% 1% 1%
1.2PHP #3 2.942.953,412500  0% 100% 1% 1%
1.2Python 3 #2 3.053.065,320256  1% 1% 100% 1%
1.2Racket #2 3.053.0620,0921122  1% 100% 0% 0%
1.5Pascal Free Pascal #2 3.753.76852785  1% 100% 0% 1%
1.5Ada 2005 GNAT 3.763.763,8801143  1% 0% 0% 100%
1.5OCaml 3.843.847,024560  0% 1% 100% 1%
1.7Java  #2 4.174.0726,324938  3% 3% 4% 96%
1.8Perl #4 4.494.503,684261  1% 0% 1% 100%
1.8Scala #4 4.513.9053,0921125  29% 7% 53% 29%
1.8PHP #2 4.584.593,728537  1% 1% 0% 100%
2.0Haskell GHC #4 4.913.4812,272341  100% 14% 15% 14%
2.1Perl #2 5.145.143,760385  1% 0% 100% 1%
2.8Clojure #5 6.875.3075,1921944  18% 39% 58% 17%
3.2Java  #3 7.954.2454,5121826  49% 55% 42% 41%
3.3Go #2 8.127.603,564674  0% 5% 2% 100%
3.3Go #4 8.187.643,552607  4% 2% 100% 2%
3.4Java  #4 8.334.3653,4441808  47% 50% 44% 48%
4.0Clojure #4 9.986.71399,3121794  35% 29% 45% 42%
4.5Ruby #4 11.2011.22147,624240  82% 1% 19% 1%
4.5Ruby #3 11.2611.28149,512242  1% 1% 0% 100%
6.4Dart 15.9415.8151,416321  1% 1% 1% 99%
6.6Perl 16.4116.424,980452  1% 0% 1% 100%
6.7Erlang HiPE 16.5316.3827,324559  1% 2% 99% 1%
6.8Erlang HiPE #2 16.8415.8328,596512  14% 77% 2% 16%
8.6Ruby 21.4421.48156,764518  1% 1% 100% 0%
8.8Scala #3 21.9820.35377,300479  30% 26% 26% 28%
8.9Ruby JRuby #4 22.1416.89635,892240  11% 13% 46% 64%
9.1Ruby JRuby #3 22.5516.69638,384242  26% 41% 40% 30%
11Java  26.3125.37376,616800  30% 29% 23% 24%
12Racket 29.1429.16122,260453  0% 0% 1% 100%
12Clojure #2 30.3126.71395,864571  28% 28% 32% 28%
13Lisp SBCL #2 31.8631.9155,544645  0% 1% 100% 1%
14Clojure #3 33.7627.79401,600482  28% 42% 28% 25%
14Ruby JRuby 34.8727.89638,308518  13% 51% 43% 20%
17Pascal Free Pascal 41.3041.326523042  1% 0% 0% 100%
25C# Mono #2 62.9162.7664,548856  1% 38% 62% 1%
29F# Mono 71.2171.0170,488513  26% 1% 0% 74%
231PHP 9 min9 min5,388736  9% 89% 3% 1%
C# Mono #3 Failed1026
F# Mono #3 Failed903
Fortran Intel Failed1768
OCaml #2 Make Error510
OCaml #3 Make Error869
OCaml #4 Make Error1481
Perl #3 Bad Output301
Ruby #2 Failed653
Ruby #5 Failed478
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
5.1Scala #2 12.569.49390,492632

 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