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.

 notes

Python 3.4.0 (default, Mar 17 2014, 08:05:26) [GCC 4.8.1] on linux

 pidigits Python 3 #4 program source code

# The Computer Language Benchmarks Game

# http://benchmarksgame.alioth.debian.org/

#

# 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))


main(int(sys.argv[1]))

 make, command-line, and program output logs

Tue, 18 Mar 2014 16:41:00 GMT

MAKE:
mv pidigits.python3-4.python3 pidigits.python3-4.py
/usr/local/src/Python-3.4.0/bin/python3.4 -OO -c "from py_compile import compile; compile('pidigits.python3-4.py')"
0.05s to complete and log all make actions

COMMAND LINE:
/usr/local/src/Python-3.4.0/bin/python3.4 pidigits.python3-4.py 2000

PROGRAM FAILED 


PROGRAM OUTPUT:

Traceback (most recent call last):
  File "pidigits.python3-4.py", 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