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.0C gcc 1.721.732,072448  1% 1% 0% 100%
1.0Pascal Free Pascal #3 1.721.731,192482  0% 2% 0% 100%
1.0Rust 1.731.736,8681420  3% 0% 1% 100%
1.1Fortran Intel #3 1.911.911,592975  0% 1% 1% 99%
1.3Python 3 #5 2.192.196,808335  1% 1% 0% 100%
1.3Haskell GHC #4 2.222.225,948341  0% 1% 1% 100%
1.3PHP #5 2.232.234,100394  1% 0% 0% 100%
1.3PHP #4 2.242.244,096384  0% 1% 2% 100%
1.3C gcc #4 2.282.292,272541  1% 0% 1% 100%
1.3Ada 2005 GNAT #2 2.282.294,1321254  0% 1% 1% 100%
1.3C++ g++ #3 2.282.293,460682  1% 0% 3% 100%
1.3Fortran Intel #2 2.292.291,592934  1% 1% 1% 100%
1.3PHP #3 2.312.324,140500  1% 0% 0% 100%
1.4Racket #2 2.332.3332,9921122  2% 1% 0% 100%
1.4Lisp SBCL 2.372.3720,7841073  1% 0% 1% 100%
1.4Python 3 #2 2.412.416,696256  0% 1% 1% 100%
1.6Pascal Free Pascal #2 2.792.791,040785  2% 1% 1% 100%
1.6OCaml 2.832.838,472560  1% 0% 0% 100%
1.9Java  #2 3.203.2033,052938  1% 1% 1% 100%
1.9Go #2 3.353.3613,052674  1% 1% 0% 100%
2.0Perl #4 3.373.384,184261  0% 1% 2% 100%
2.0PHP #2 3.403.404,460537  1% 1% 1% 100%
2.0Go #4 3.423.4312,164607  1% 1% 1% 100%
2.0Perl #3 3.453.464,160301  0% 1% 0% 100%
2.0Scala #4 3.463.4662,3721125  1% 1% 1% 100%
2.2Perl #2 3.853.864,232385  1% 1% 1% 100%
3.1Clojure #5 5.405.4091,9281944  1% 1% 0% 100%
3.8Java  #3 6.506.5072,4521826  0% 1% 1% 100%
3.8Java  #4 6.596.6068,9001808  0% 1% 1% 100%
4.7Clojure #4 8.128.13414,9241794  1% 0% 0% 100%
4.9Ruby #2 8.378.39276,892653  1% 3% 0% 100%
6.4Ada 2005 GNAT 10.9810.984,4001143  0% 1% 0% 100%
6.5F# Mono #3 11.2111.2242,660903  0% 1% 1% 100%
6.5Ruby #3 11.2011.22147,884242  0% 1% 1% 100%
6.5Ruby #4 11.2111.23149,764240  0% 1% 1% 100%
6.5C# Mono #3 11.2311.2441,1121026  0% 0% 1% 100%
6.5Dart 11.2311.2441,284321  1% 1% 0% 100%
7.3Smalltalk VisualWorks #4 12.5912.6056,352652  0% 1% 1% 100%
8.6Perl 14.7814.786,264452  1% 0% 1% 100%
8.8Scala #3 15.2215.26382,216479  2% 2% 1% 100%
9.4Erlang HiPE #2 16.2016.2223,228512  1% 1% 0% 100%
10Ruby JRuby #4 17.3817.41660,360240  1% 0% 1% 100%
10Erlang HiPE 17.6717.6926,252559  1% 1% 0% 100%
10Ruby JRuby #3 18.0118.05672,876242  1% 1% 0% 100%
11Java  18.1618.20381,788800  0% 1% 1% 100%
13Clojure #2 21.5621.59417,684571  0% 1% 1% 100%
13Lisp SBCL #2 21.6821.72130,400645  0% 0% 1% 100%
13Racket 22.4222.46122,412453  1% 0% 1% 100%
15Clojure #3 25.4425.48421,960482  1% 1% 1% 100%
16Ruby JRuby 27.7027.75746,984518  1% 0% 1% 100%
17Pascal Free Pascal 29.4429.458203042  1% 1% 0% 100%
18Ruby 30.2930.35161,248518  0% 0% 1% 100%
22C# Mono #2 38.7238.7968,740856  0% 0% 1% 100%
24F# Mono 41.5141.5983,112513  1% 1% 0% 100%
284Hack 8 min8 min121,332735  0% 1% 1% 100%
320PHP 9 min9 min6,304736  1% 1% 1% 100%
Fortran Intel Failed1768
Lua Failed522
Lua #7 Failed477
Lua #3 Failed414
Lua #2 Failed1144
Lua #5 Failed479
OCaml #2 Make Error510
OCaml #4 Make Error1481
OCaml #3 Make Error869
Ruby #5 Failed478
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Lua #4 Failed  745
 Python 3 #4 Failed  248
 Lua #8 Failed  609
5.4Scala #2 9.229.23408,092632
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