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
15.695.698,892367  5% 0% 100% 1%
15.705.708,912367  5% 1% 100% 1%
15.535.539,000367  5% 94% 0% 6%

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

Read iobench benchmark to see what this program should do.

 notes

Python 3.3.1 (default, Apr 11 2013, 12:45:45)
[GCC 4.7.2] on linux

 iobench Python 3 program source code

import os, time

def measure(func, repetitions, size):
    t0 = time.time()
    func(repetitions, size)
    print(
        func,
        "%d bytes, %.2fus per write" % (
            size,
            (time.time() - t0) / repetitions * 1000 * 1000
        )
    )

def fwrite(repetitions, size):
    fd = os.open("/dev/null", os.O_WRONLY)
    for i in range(repetitions):
        os.write(fd, b" " * size)

def fread(repetitions, size):
    fd = os.open("/dev/full", os.O_RDONLY)
    for i in range(repetitions):
        os.read(fd, size)

def file_write(repetitions, size):
    f = open("/dev/null", "w")
    for i in range(repetitions):
        f.write(" " * size)
    f.flush()

def file_read(repetitions, size):
    f = open("/dev/full")
    for i in range(repetitions):
        f.read(size)

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

 make, command-line, and program output logs

Wed, 22 Jan 2020 18:37:17 GMT

COMMAND LINE:
/usr/bin/python3 iobench.python3 1

PROGRAM OUTPUT NOT CHECKED:
<function fread at 0x7f36cd417dc0> 100 bytes, 0.82us per write
<function fwrite at 0x7f36cd417d30> 100 bytes, 0.80us per write
<function fread at 0x7f36cd417dc0> 1000 bytes, 0.92us per write
<function fwrite at 0x7f36cd417d30> 1000 bytes, 0.90us per write
<function fread at 0x7f36cd417dc0> 10000 bytes, 1.35us per write
<function fwrite at 0x7f36cd417d30> 10000 bytes, 1.03us per write
<function file_read at 0x7f36cd417ee0> 100 bytes, 0.17us per write
<function file_write at 0x7f36cd417e50> 100 bytes, 0.16us per write
<function file_read at 0x7f36cd417ee0> 1000 bytes, 0.70us per write
<function file_write at 0x7f36cd417e50> 1000 bytes, 0.38us per write
<function file_read at 0x7f36cd417ee0> 10000 bytes, 4.23us per write
<function file_write at 0x7f36cd417e50> 10000 bytes, 1.53us per write

Revised BSD license

  Home   Conclusions   License   Play