/mobile Handheld Friendly website

 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.

     sortsortsort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0C gcc 1.721.73936448  0% 0% 1% 100%
1.1ATS #2 1.881.89816942  0% 99% 0% 1%
1.1Fortran Intel #3 1.911.921,324975  0% 2% 1% 100%
1.3PHP #4 2.182.184,196384  1% 0% 0% 100%
1.3PHP #3 2.242.244,408500  0% 0% 100% 1%
1.3Ada 2005 GNAT #2 2.292.292,0761254  0% 0% 100% 0%
1.3Fortran Intel #2 2.292.301,328934  0% 0% 2% 100%
1.3C++ g++ #3 2.292.301,648682  0% 0% 0% 100%
1.3ATS #3 2.292.309241154  0% 100% 0% 0%
1.3C gcc #4 2.292.30936541  0% 0% 0% 100%
1.3Racket #2 2.312.3224,4961122  0% 100% 0% 0%
1.4Lisp SBCL 2.382.385,7121073  0% 0% 0% 100%
1.4Python 3 #2 2.402.406,972255  0% 0% 100% 1%
1.6Pascal Free Pascal #2 2.782.781,024785  0% 0% 0% 100%
1.6OCaml 2.802.819,036560  0% 3% 1% 100%
1.8ATS 3.133.131,164671  0% 0% 0% 100%
2.0PHP #2 3.403.414,660537  1% 0% 100% 1%
2.0Go #4 3.453.284,216607  19% 81% 0% 2%
2.1Scala #4 3.562.9852,7761125  23% 11% 79% 7%
2.4Haskell GHC #4 4.182.776,076341  18% 100% 17% 14%
2.5Perl #4 4.374.384,316261  1% 0% 0% 100%
2.6Perl #3 4.464.474,316301  0% 100% 0% 0%
2.6Python 3 #3 4.544.557,084520  0% 0% 1% 100%
2.9Perl #2 4.924.924,396385  1% 100% 1% 0%
3.7Python 3 6.406.416,712242  0% 0% 0% 100%
5.4OCaml #4 9.319.322,8321481  0% 0% 100% 0%
5.5Ruby 2.0 #3 9.509.5214,800242  0% 0% 0% 100%
5.7Ruby 2.0 #2 9.8011.323,669,708653  4% 92% 7% 12%
5.9Java 7  #4 10.204.2960,5201808  68% 62% 65% 45%
6.0Java 7  #3 10.374.3463,1481826  69% 68% 66% 38%
6.2Ada 2005 GNAT 10.7710.782,1361143  65% 0% 0% 35%
6.4F# Mono #3 11.0511.0616,392903  0% 0% 0% 100%
6.4C# Mono #3 11.0511.0615,2801026  0% 0% 1% 100%
9.2Scala #3 15.7914.68433,696479  81% 2% 5% 20%
9.2Perl 15.8315.846,452452  0% 0% 100% 0%
9.3Erlang #2 16.0315.6833,568512  2% 1% 1% 99%
9.3Erlang 16.1116.1221,152559  100% 0% 0% 0%
9.6Erlang HiPE #2 16.4715.5727,604512  1% 5% 99% 1%
9.7OCaml #3 16.7716.797,484869  0% 0% 100% 0%
10Erlang HiPE 17.5517.5525,368559  1% 10% 11% 79%
11Lisp SBCL #2 18.5818.62316,768645  0% 1% 100% 0%
11Java 7  19.2718.37372,852800  1% 2% 99% 3%
12Ruby JRuby #3 20.1917.70599,884242  7% 95% 9% 4%
12OCaml #2 20.7220.757,740510  0% 0% 100% 0%
13Dart 22.3122.3541,632359  0% 100% 0% 0%
13Ruby 2.0 22.4222.4617,316518  0% 0% 100% 0%
15Racket 25.1525.18120,068453  0% 100% 0% 0%
15Clojure #2 25.9321.1986,184571  40% 10% 29% 42%
17Pascal Free Pascal 29.4429.458243042  73% 0% 0% 28%
17Clojure #3 29.5222.6182,408482  17% 48% 27% 38%
20Ruby JRuby 34.9932.13608,596518  2% 98% 4% 5%
28C# Mono #2 47.7940.7817,236856  15% 53% 36% 12%
43F# Mono 74.5457.9823,492513  15% 44% 53% 16%
313PHP 8 min8 min6,192736  0% 0% 0% 100%
Fortran Intel Failed1768
Java 7  #2 Failed938
"wrong" (different) algorithm / less comparable programs
0.0Python 3 #4 0.050.05?246
4.8Scala #2 8.296.93369,508632

 pidigits benchmark : Streaming arbitrary-precision arithmetic

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