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.731.73932448  0% 1% 1% 100%
1.0Rust #2 1.731.735,3081297  0% 3% 0% 100%
1.1Fortran Intel #3 1.911.911,324975  0% 3% 0% 100%
1.1Lua #5 1.931.941,932479  0% 1% 1% 100%
1.2PHP #5 2.152.154,284394  0% 0% 0% 100%
1.3PHP #4 2.162.174,284384  0% 0% 0% 100%
1.3Haskell GHC #4 2.242.245,964341  1% 0% 1% 100%
1.3PHP #3 2.242.254,328500  0% 1% 0% 100%
1.3C gcc #4 2.292.29928541  2% 1% 0% 100%
1.3Fortran Intel #2 2.292.291,324934  3% 0% 0% 100%
1.3Ada 2005 GNAT #2 2.292.302,0721254  0% 1% 1% 100%
1.3C++ g++ #3 2.292.301,656682  0% 1% 2% 100%
1.4Lua #3 2.332.341,672414  0% 0% 0% 100%
1.4Racket #2 2.342.3425,6201122  0% 1% 1% 100%
1.4Lisp SBCL 2.362.3611,0281073  1% 0% 1% 100%
1.4Python 3 #2 2.392.396,612256  2% 0% 1% 100%
1.6Pascal Free Pascal #2 2.792.791,040785  2% 1% 1% 100%
1.6OCaml 2.802.819,036560  0% 1% 1% 100%
1.7Lua 2.942.951,748522  0% 0% 1% 100%
1.8Java  #2 3.153.1528,972938  1% 0% 2% 100%
2.0PHP #2 3.383.384,800537  0% 0% 0% 100%
2.0Scala #4 3.513.5255,1241125  1% 0% 1% 100%
2.1Lua #7 3.703.711,680477  0% 0% 0% 100%
2.4Go #2 4.064.063,612674  0% 1% 0% 100%
2.4Go #4 4.184.183,624607  0% 0% 1% 100%
2.5Perl #4 4.294.304,100261  0% 0% 0% 100%
2.5Perl #3 4.374.374,052301  0% 0% 0% 100%
2.6Python 3 #3 4.534.536,796521  0% 1% 0% 100%
2.8Perl #2 4.774.784,092385  0% 0% 0% 100%
3.1Clojure #5 5.265.2782,8441944  0% 1% 0% 100%
3.5Java  #3 6.096.1062,8841826  0% 0% 1% 100%
3.6Python 3 6.146.146,112242  1% 0% 0% 100%
3.6Java  #4 6.186.1858,4321808  1% 1% 1% 100%
4.8Clojure #4 8.278.28408,2241794  1% 1% 1% 100%
5.4OCaml #4 9.309.312,8321481  0% 0% 0% 100%
6.3Ada 2005 GNAT 10.8510.862,3321143  1% 0% 1% 100%
6.3Ruby #4 10.9310.9576,836240  0% 1% 1% 100%
6.4Ruby #3 10.9610.9876,344242  1% 1% 0% 100%
6.4F# Mono #3 11.0011.0120,736903  1% 1% 0% 100%
6.4C# Mono #3 11.0211.0220,3001026  1% 1% 2% 100%
6.5Smalltalk VisualWorks #4 11.2511.2743,644652  0% 0% 0% 100%
8.4Rust 14.4514.464,748691  1% 0% 0% 100%
8.7Scala #3 14.9715.00371,680479  1% 1% 0% 100%
8.8Perl 15.2515.266,100452  0% 0% 0% 100%
9.2Erlang HiPE #2 15.9415.9624,856512  0% 1% 1% 100%
9.4OCaml #3 16.2016.237,752869  0% 0% 0% 100%
10Ruby JRuby #4 17.3817.41660,360240  1% 0% 1% 100%
10Erlang HiPE 17.5217.5425,364559  1% 1% 0% 100%
10Ruby JRuby #3 18.0118.05672,876242  1% 1% 0% 100%
11Java  18.3418.37379,564800  0% 0% 1% 100%
12OCaml #2 19.9019.947,764510  0% 0% 0% 100%
12Lisp SBCL #2 21.4021.44115,440645  0% 1% 1% 100%
13Clojure #2 22.1322.17409,688571  1% 1% 1% 100%
14Clojure #3 24.8824.93413,112482  1% 0% 0% 100%
15Dart 26.3426.3633,484321  1% 0% 1% 100%
16Ruby JRuby 27.7027.75746,984518  1% 0% 1% 100%
16Racket 27.8127.85120,304453  1% 0% 1% 100%
17Pascal Free Pascal 29.4429.458203042  1% 1% 0% 100%
17Ruby 29.8729.93104,120518  1% 0% 1% 100%
23C# Mono #2 39.8239.8949,084856  0% 1% 0% 100%
126Lua #2 217.52217.582,2161144  0% 0% 0% 100%
263Hack 7 min7 min82,812735  1% 1% 0% 100%
312PHP 8 min8 min6,392736  0% 0% 0% 100%
F# Mono Failed513
Fortran Intel Failed1768
Ruby #2 Failed653
Ruby #5 Failed478
Scala Failed355
"wrong" (different) algorithm / less comparable programs
 Python 3 #4 Failed  248
0.3Lua #8 0.580.591,424609
4.6Scala #2 7.998.01372,464632
66Lua #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