performance measurements

Each table row shows performance measurements for this Python 3 program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
2,000Failed  248   

Read the ↓ make, command line, and program output logs to see how this program was run.

Read pidigits benchmark to see what this program should do.


Python 3.4.3 (default, Apr 5 2015, 10:03:09) [GCC 4.8.2] on linux

 pidigits Python 3 #4 program source code

# The Computer Language Benchmarks Game



# contributed Daniel Nanz

import sys
import gmpy2

def get_pistring(n, pi=gmpy2.pi):

    return str(pi(int(3.35 * n))).replace('.', '')[0 : n]

def main(n, width=10, line='{}\t:{}'):

    pistring = get_pistring(n)
    for i in range(0, n - width + 1, width):
        print(line.format(pistring[i : i + width], i + width))
    if n % width > 0:
        print(line.format(pistring[-(n % width) : ].ljust(width), n))


 make, command-line, and program output logs

Mon, 06 Apr 2015 03:09:55 GMT

mv pidigits.python3-4.python3
0.01s to complete and log all make actions

/usr/local/src/Python-3.4.3/bin/python3.4 2000



Traceback (most recent call last):
  File "", line 10, in <module>
    def get_pistring(n, pi=gmpy2.pi):
AttributeError: 'module' object has no attribute 'pi'

Revised BSD license

  Home   Conclusions   License   Play