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.0Pascal Free Pascal #3 2.482.491,124482  1% 2% 1% 100%
1.0Rust 2.492.496,6681420  1% 1% 0% 100%
1.0C gcc 2.492.502,172448  1% 0% 1% 100%
1.1Fortran Intel #2 2.662.661,464934  0% 0% 1% 100%
1.1Fortran Intel #3 2.662.671,200975  1% 1% 1% 100%
1.1Ada 2005 GNAT #2 2.682.683,8241254  0% 1% 0% 100%
1.1C gcc #4 2.682.682,056541  1% 1% 2% 100%
1.1C++ g++ #3 2.682.683,152682  3% 0% 1% 100%
1.1Python 3 #5 2.732.745,452335  0% 2% 1% 100%
1.1Lisp SBCL 2.772.788,4961073  0% 1% 2% 100%
1.1PHP #5 2.842.843,396394  1% 1% 0% 100%
1.2PHP #4 2.862.863,388384  0% 1% 1% 100%
1.2PHP #3 2.942.943,460500  2% 1% 0% 100%
1.2Haskell GHC #4 2.962.965,644341  0% 1% 2% 100%
1.2Python 3 #2 3.043.055,276256  2% 1% 0% 100%
1.2Racket #2 3.053.0620,0921122  0% 1% 0% 100%
1.5Pascal Free Pascal #2 3.753.75852785  1% 0% 1% 100%
1.5Ada 2005 GNAT 3.763.763,9961143  0% 2% 0% 100%
1.5OCaml 3.843.847,020560  1% 1% 1% 100%
1.7Java  #2 4.144.1426,616938  2% 0% 1% 100%
1.7Perl #4 4.344.353,360261  1% 0% 1% 100%
1.8Scala #4 4.444.4453,5041125  1% 2% 0% 100%
1.8PHP #2 4.584.583,720537  0% 1% 1% 100%
2.0Perl #2 4.954.963,384385  0% 0% 1% 100%
2.7Clojure #5 6.806.8178,1681944  2% 0% 0% 100%
3.2Java  #3 7.847.8552,0281826  2% 1% 0% 100%
3.2Java  #4 7.907.9149,6201808  1% 1% 0% 100%
3.3Go #2 8.208.213,560674  0% 1% 0% 100%
3.3Go #4 8.268.273,576607  0% 1% 1% 100%
3.8Clojure #4 9.479.48402,1841794  2% 1% 1% 100%
4.5Ruby #4 11.1811.20148,712240  0% 0% 1% 100%
4.5Ruby #3 11.2111.23148,636242  0% 1% 1% 100%
6.1Erlang HiPE #2 15.2315.2518,968512  0% 1% 0% 100%
6.2Erlang HiPE 15.4415.4718,504559  0% 1% 1% 100%
6.3Perl 15.6715.684,600452  0% 2% 1% 100%
6.4Dart 15.8415.8651,920321  0% 1% 1% 100%
8.4Ruby JRuby #4 20.8620.90633,364240  0% 1% 1% 100%
8.6Ruby JRuby #3 21.2921.33637,664242  0% 1% 1% 100%
8.6Ruby 21.4621.50156,652518  0% 1% 1% 100%
8.7Scala #3 21.6421.68377,796479  1% 1% 0% 100%
11Java  26.8926.94376,404800  1% 1% 0% 100%
11Smalltalk VisualWorks #4 28.0628.0729,208652  0% 0% 1% 100%
12Racket 29.1429.18123,848453  0% 1% 1% 100%
12Clojure #2 30.0630.11401,800571  0% 1% 1% 100%
13Lisp SBCL #2 31.8331.8855,544645  0% 1% 1% 100%
14Clojure #3 33.8033.86402,092482  1% 1% 1% 100%
15Ruby JRuby 37.0237.08676,152518  0% 1% 1% 100%
17Pascal Free Pascal 41.2941.306483042  1% 0% 0% 100%
25C# Mono #2 62.9563.0563,936856  0% 1% 1% 100%
29F# Mono 71.3171.4269,432513  0% 1% 1% 100%
231PHP 9 min9 min5,392736  0% 1% 1% 100%
C CINT #4 Failed541
C# Mono #3 Failed1026
F# Mono #3 Failed903
Fortran Intel Failed1768
Lua Failed522
Lua #5 Failed479
Lua #3 Failed414
Lua #2 Failed1144
Lua #7 Failed477
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
 Lua #4 Failed  745
 Lua #8 Failed  609
 Python 3 #4 Failed  248
5.0Scala #2 12.4212.44391,728632
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