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
119.9119.9574,804367  7% 1% 1% 100%
119.8920.8574,500367  100% 1% 1% 1%
120.1020.1574,420367  6% 1% 100% 0%

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

Thu, 26 Apr 2018 16:42:32 GMT

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

PROGRAM OUTPUT NOT CHECKED:
<function fread at 0x00007f009a39af20> 100 bytes, 0.38us per write
<function fwrite at 0x00007f009a39b1a0> 100 bytes, 0.34us per write
<function fread at 0x00007f009a39af20> 1000 bytes, 0.42us per write
<function fwrite at 0x00007f009a39b1a0> 1000 bytes, 0.34us per write
<function fread at 0x00007f009a39af20> 10000 bytes, 0.95us per write
<function fwrite at 0x00007f009a39b1a0> 10000 bytes, 0.34us per write
<function file_read at 0x00007f009a39b2e0> 100 bytes, 0.69us per write
<function file_write at 0x00007f009a39b240> 100 bytes, 0.26us per write
<function file_read at 0x00007f009a39b2e0> 1000 bytes, 6.37us per write
<function file_write at 0x00007f009a39b240> 1000 bytes, 2.17us per write
<function file_read at 0x00007f009a39b2e0> 10000 bytes, 65.64us per write
<function file_write at 0x00007f009a39b240> 10000 bytes, 22.24us per write

Revised BSD license

  Home   Conclusions   License   Play