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 JRuby #4 18.1312.71657,412240  15% 79% 34% 16%
1.0Ruby #4 10.9610.9876,712240  0% 1% 100% 1%
1.0Python 3 6.156.156,040242  0% 0% 100% 1%
1.0Ruby JRuby #3 18.5412.70666,456242  18% 46% 66% 17%
1.0Ruby #3 10.9610.9876,272242  1% 1% 100% 1%
1.1Python 3 #2 2.402.416,600256  1% 2% 0% 100%
1.1Perl #4 4.374.384,316261  1% 0% 0% 100%
1.3Perl #3 4.464.474,316301  0% 100% 0% 0%
1.3Dart 26.4226.2933,520321  0% 1% 1% 100%
1.4Haskell GHC #4 3.982.716,212341  17% 16% 100% 17%
1.6PHP #4 2.162.174,284384  0% 0% 1% 100%
1.6Perl #2 4.924.924,396385  1% 100% 1% 0%
1.6PHP #5 2.162.164,280394  1% 0% 0% 100%
1.9C gcc 1.731.73932448  1% 1% 3% 100%
1.9Perl 15.8315.846,452452  0% 0% 100% 0%
1.9Racket 27.5227.55118,288453  1% 0% 100% 1%
2.0Scala #3 15.3814.23373,080479  97% 4% 7% 3%
2.0Clojure #3 25.9220.46416,172482  22% 11% 29% 69%
2.1PHP #3 2.242.254,496500  0% 0% 0% 100%
2.1OCaml #2 22.0522.087,744510  0% 0% 100% 0%
2.1Erlang #2 16.2115.8137,764512  74% 2% 14% 14%
2.1Erlang HiPE #2 16.4315.9429,812512  67% 32% 2% 3%
2.2Ruby JRuby 28.4220.76733,468518  90% 22% 15% 12%
2.2Ruby 29.9429.99104,264518  2% 0% 100% 1%
2.2Python 3 #3 4.534.546,788521  2% 1% 0% 100%
2.2PHP #2 3.383.394,768537  1% 61% 40% 1%
2.3C gcc #4 2.292.29928541  1% 0% 0% 100%
2.3Erlang 16.2116.2128,352559  1% 1% 1% 100%
2.3Erlang HiPE 17.2117.2228,116559  1% 4% 99% 1%
2.3OCaml 2.812.819,036560  0% 0% 100% 0%
2.4Clojure #2 23.0019.39414,268571  20% 28% 26% 47%
2.5Go #4 4.103.873,620607  1% 1% 4% 100%
2.7Lisp SBCL #2 21.4921.53115,440645  1% 0% 100% 1%
2.8Go #2 3.953.773,612674  69% 2% 5% 34%
2.8C++ g++ #3 2.292.301,656682  1% 0% 0% 100%
2.9Rust 14.7814.784,756691  0% 1% 100% 0%
3.1Hack 7 min7 min85,072735  1% 1% 54% 47%
3.1PHP 8 min8 min6,392736  0% 99% 1% 0%
3.3Pascal Free Pascal #2 2.792.791,044785  1% 1% 0% 100%
3.3Java  18.6517.64385,108800  71% 15% 10% 12%
3.6C# Mono #2 39.9740.0148,920856  14% 86% 1% 1%
3.6OCaml #3 17.2417.277,724869  7% 0% 100% 1%
3.8F# Mono #3 11.0111.0120,732903  1% 0% 100% 0%
3.9Fortran Intel #2 2.292.301,328934  0% 0% 2% 100%
3.9Java  #2 3.153.0329,084938  3% 4% 81% 21%
4.1Fortran Intel #3 1.911.921,324975  0% 2% 1% 100%
4.3C# Mono #3 11.0211.0320,4201026  100% 1% 1% 0%
4.5Lisp SBCL 2.372.3711,0281073  9% 91% 1% 0%
4.7Racket #2 2.342.3425,6481122  0% 1% 0% 100%
4.7Scala #4 3.632.9856,7721125  10% 6% 100% 9%
4.8Ada 2005 GNAT 10.8510.862,1561143  0% 1% 100% 1%
5.2Ada 2005 GNAT #2 2.302.302,0721254  0% 1% 100% 3%
5.4Rust #2 1.731.735,3081297  1% 100% 0% 0%
6.2OCaml #4 9.309.312,8361481  11% 0% 1% 89%
7.5Clojure #4 8.605.54413,0161794  40% 24% 79% 13%
7.5Java  #4 11.334.4865,6241808  68% 62% 62% 61%
7.6Java  #3 9.114.0665,1841826  56% 54% 57% 56%
8.1Clojure #5 5.434.1984,5881944  64% 13% 47% 8%
13Pascal Free Pascal 29.4429.468203042  99% 1% 1% 1%
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
2.6Scala #2 8.406.63373,220632

 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