pidigits benchmark N=10,000

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

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.0Ruby #4 11.1211.1475,152240  0% 1% 0% 100%
1.0Ruby JRuby #4 16.8916.92648,016240  0% 1% 0% 100%
1.0Ruby #3 11.1311.1574,800242  1% 1% 0% 100%
1.0Python 3 6.146.146,112242  1% 0% 0% 100%
1.0Ruby JRuby #3 17.4017.44683,148242  0% 0% 1% 100%
1.1Python 3 #2 2.392.396,612256  2% 0% 1% 100%
1.1Perl #4 4.294.304,100261  0% 0% 0% 100%
1.3Perl #3 4.374.374,052301  0% 0% 0% 100%
1.3Dart 26.5826.6129,516321  1% 1% 0% 100%
1.4Haskell GHC #4 2.242.245,964341  1% 0% 1% 100%
1.6PHP #4 2.162.174,284384  0% 0% 0% 100%
1.6Perl #2 4.774.784,092385  0% 0% 0% 100%
1.6PHP #5 2.152.154,284394  0% 0% 0% 100%
1.7Lua #3 2.332.341,672414  0% 0% 0% 100%
1.9C gcc 1.731.73932448  0% 1% 1% 100%
1.9Perl 15.2515.266,100452  0% 0% 0% 100%
1.9Racket 27.8127.85120,304453  1% 0% 1% 100%
2.0Lua #7 3.703.711,680477  0% 0% 0% 100%
2.0Ruby #5 3.283.29639,684478  0% 1% 1% 100%
2.0Scala #3 21.0721.241,085,080479  0% 0% 1% 100%
2.0Lua #5 1.931.941,932479  0% 1% 1% 100%
2.0Clojure #3 25.0725.12303,200482  0% 0% 1% 100%
2.1PHP #3 2.242.254,328500  0% 1% 0% 100%
2.1OCaml #2 19.9019.947,764510  0% 0% 0% 100%
2.1Erlang HiPE #2 15.5215.5421,336512  0% 0% 0% 100%
2.2Ruby JRuby 26.8426.89768,560518  0% 1% 1% 100%
2.2Ruby 30.6430.69232,724518  0% 1% 0% 100%
2.2Python 3 #3 4.534.536,796521  0% 1% 0% 100%
2.2Lua 2.942.951,748522  0% 0% 1% 100%
2.2PHP #2 3.383.384,800537  0% 0% 0% 100%
2.3C gcc #4 2.292.29928541  2% 1% 0% 100%
2.3Erlang HiPE 17.3317.3522,216559  0% 0% 0% 100%
2.3OCaml 2.802.819,036560  0% 1% 1% 100%
2.4Clojure #2 22.4022.44305,236571  0% 0% 1% 100%
2.5Go #4 3.973.973,636607  1% 0% 1% 100%
2.7Lisp SBCL #2 21.3621.41115,572645  0% 1% 1% 100%
2.7Smalltalk VisualWorks #4 11.2511.2743,644652  0% 0% 0% 100%
2.8Go #2 3.943.943,664674  1% 0% 2% 100%
2.8C++ g++ #3 2.292.301,656682  0% 1% 2% 100%
2.9Rust 14.4514.464,748691  1% 0% 0% 100%
3.1Hack 7 min7 min59,512735  1% 0% 0% 100%
3.1PHP 8 min8 min6,392736  0% 0% 0% 100%
3.3Pascal Free Pascal #2 2.792.791,040785  2% 1% 1% 100%
3.3Java  19.1719.21176,492800  0% 1% 1% 100%
3.6C# Mono #2 39.8239.8949,084856  0% 1% 0% 100%
3.6OCaml #3 16.2016.237,752869  0% 0% 0% 100%
3.8F# Mono #3 11.0011.0120,736903  1% 1% 0% 100%
3.9Fortran Intel #2 2.292.291,324934  3% 0% 0% 100%
3.9Java  #2 3.143.1423,224938  0% 1% 2% 100%
4.1Fortran Intel #3 1.911.911,324975  0% 3% 0% 100%
4.3C# Mono #3 11.0211.0220,3001026  1% 1% 2% 100%
4.5Lisp SBCL 2.372.379,1881073  1% 0% 3% 100%
4.7Racket #2 2.342.3425,6201122  0% 1% 1% 100%
4.7Scala #4 3.643.6445,9641125  0% 0% 2% 100%
4.8Ada 2005 GNAT 10.8510.862,3321143  1% 0% 1% 100%
4.8Lua #2 217.52217.582,2161144  0% 0% 0% 100%
5.2Ada 2005 GNAT #2 2.292.302,0721254  0% 1% 1% 100%
5.4Rust #2 1.731.735,3081297  0% 3% 0% 100%
6.2OCaml #4 9.309.312,8321481  0% 0% 0% 100%
7.5Clojure #4 8.298.30176,6761794  0% 1% 1% 100%
7.5Java  #4 6.436.4452,0481808  0% 1% 0% 100%
7.6Java  #3 6.326.3254,8041826  0% 1% 0% 100%
8.1Clojure #5 5.355.3672,1121944  2% 1% 0% 100%
13Pascal Free Pascal 29.4429.458203042  1% 1% 0% 100%
F# Mono Failed513
Fortran Intel Failed1768
Ruby #2 Failed653
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
2.5Lua #8 0.580.591,424609
2.6Scala #2 8.028.04387,352632
3.1Lua #4 113.36113.391,816745
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