performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
121.2521.3177,888367  9% 93% 5% 12%
122.4522.5477,728367  15% 14% 100% 11%
121.5021.5777,836367  10% 48% 6% 59%

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

 iobench PyPy 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

Tue, 12 Feb 2019 12:02:45 GMT

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

PROGRAM OUTPUT NOT CHECKED:
<function fread at 0x00007f5bc7bc2980> 100 bytes, 0.41us per write
<function fwrite at 0x00007f5bc7bc2c00> 100 bytes, 0.35us per write
<function fread at 0x00007f5bc7bc2980> 1000 bytes, 0.44us per write
<function fwrite at 0x00007f5bc7bc2c00> 1000 bytes, 0.34us per write
<function fread at 0x00007f5bc7bc2980> 10000 bytes, 0.96us per write
<function fwrite at 0x00007f5bc7bc2c00> 10000 bytes, 0.34us per write
<function file_read at 0x00007f5bc7bc2d40> 100 bytes, 0.77us per write
<function file_write at 0x00007f5bc7bc2ca0> 100 bytes, 0.25us per write
<function file_read at 0x00007f5bc7bc2d40> 1000 bytes, 7.12us per write
<function file_write at 0x00007f5bc7bc2ca0> 1000 bytes, 1.97us per write
<function file_read at 0x00007f5bc7bc2d40> 10000 bytes, 73.53us per write
<function file_write at 0x00007f5bc7bc2ca0> 10000 bytes, 20.71us per write

Revised BSD license

  Home   Conclusions   License   Play