Python Interpreters Benchmarks
x64 ArchLinux : AMD® Ryzen 7 4700U®

 performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load

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

Read  benchmark to see what this program should do.

 notes

  source code

# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# contributed Daniel Nanz

import sys
try:
    import gmpy2
except ImportError:
    import gmpy_cffi as gmpy2

if not hasattr(gmpy2, 'pi'):
    gmpy2.pi = gmpy2.const_pi

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

 Fri, 09 Sep 2022 06:05:09 GMT

COMMAND LINE:
 /usr/bin/pypy3 pidigits.pypy3-4.pypy3 10000

PROGRAM FAILED 


PROGRAM OUTPUT:

Traceback (most recent call last):
  File "pidigits.pypy3-4.pypy3", line 8, in <module>
    import gmpy2
ModuleNotFoundError: No module named 'gmpy2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pidigits.pypy3-4.pypy3", line 10, in <module>
    import gmpy_cffi as gmpy2
ModuleNotFoundError: No module named 'gmpy_cffi'

Revised BSD license

  Home   Conclusions   License   Play