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
10.020.02?366  0% 0% 0% 0% 0% 100% 0% 0%

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

import os, time

cdef measure(func, int num1, int num2):
    t0 = time.time()
    func(num1, num2)
    print(
        func, 
        "%d bytes, %.2fus per write" % (
            num2, 
            (time.time() - t0) / num1 * 1000 * 1000
        )
    )

cdef fwrite(int num, int num2):
    fd = os.open("/dev/null", os.O_WRONLY)
    for i in range(num):
        os.write(fd, b" " * num2)

cdef fread(int num, int num2):
    fd = os.open("/dev/full", os.O_RDONLY)
    for i in range(num):
        os.read(fd, num2)

cdef file_write(int num, int num2):
    f = open("/dev/null", "w")
    for i in range(num):
        f.write(" " * num2)
    f.flush()

cdef file_read(int num, int num2):
    f = open("/dev/full")
    for i in range(num):
        f.read(num2)

if __name__ == '__main__':
    measure(fread, 10000000, 100)
    measure(fwrite, 10000000, 100)
    measure(fread, 10000000, 1000)
    measure(fwrite, 10000000, 1000)
    measure(fread, 1000000, 10000)
    measure(fwrite, 1000000, 10000)
    measure(file_read, 10000000, 100)
    measure(file_write, 10000000, 100)
    measure(file_read, 10000000, 1000)
    measure(file_write, 10000000, 1000)
    measure(file_read, 1000000, 10000)
    measure(file_write, 1000000, 10000)

 make, command-line, and program output logs

 Sun, 23 Apr 2023 09:13:24 GMT

MAKE:
make[1]: Vstupuje se do adresáře „/home/dundee/work/pybenchmarks/bencher/tmp/iobench/tmp“
cp iobench.cython `echo iobench.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx
cythonize -3 -bi `echo iobench.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx
Compiling /home/dundee/work/pybenchmarks/bencher/tmp/iobench/tmp/iobench.pyx because it changed.
[1/1] Cythonizing /home/dundee/work/pybenchmarks/bencher/tmp/iobench/tmp/iobench.pyx
make[1]: Opouští se adresář „/home/dundee/work/pybenchmarks/bencher/tmp/iobench/tmp“
2.18s to complete and log all make actions

COMMAND LINE:
 /usr/bin/python3 -c "import iobench" 1

PROGRAM OUTPUT NOT CHECKED:

Revised BSD license

  Home   Conclusions   License   Play