• Kirill Smelkov's avatar
    py.bench: Less noisy output · 074ce24d
    Kirill Smelkov authored
    For several benchmarks in a python module instead of always printing
    whole benchmark function path (nodeid in pytest speak), first print
    
    	pymod: modulename
    
    header, and then only function names.
    
    Before patch:
    
    ============================= test session starts ==============================
    platform linux2 -- Python 2.7.14, pytest-3.3.0, py-1.5.2, pluggy-0.6.0
    rootdir: /home/kirr/src/wendelin/wendelin.core, inifile:
    collected 14 items
    
    bigfile/tests/bench_0virtmem.py::bench_file_mmapread_hole 	0.22  (0.39 0.22 0.22)
    bigfile/tests/bench_0virtmem.py::bench_file_read_hole    	0.24  (0.24 0.24 0.24)
    bigfile/tests/bench_0virtmem.py::bench_file_readbig_hole 	0.30  (0.30 0.30 0.30)
    bigfile/tests/bench_0virtmem.py::bench_bigf_read_hole    	0.43  (0.43 0.43 0.43)
    bigfile/tests/bench_0virtmem.py::bench_file_mmapwrite0   	0.12  (0.13 0.12 0.13)
    bigfile/tests/bench_0virtmem.py::bench_file_write55      	0.08  (0.08 0.08 0.08)
    bigfile/tests/bench_0virtmem.py::bench_bigf_writeff      	0.45  (0.45 0.45 0.45)
    bigfile/tests/bench_0virtmem.py::bench_file_mmapread     	0.21  (0.21 0.21 0.22)
    bigfile/tests/bench_0virtmem.py::bench_file_read         	0.23  (0.23 0.24 0.24)
    bigfile/tests/bench_0virtmem.py::bench_file_readbig      	0.30  (0.30 0.30 0.30)
    bigfile/tests/bench_0virtmem.py::bench_bigf_read         	0.43  (0.44 0.43 0.44)
    bigfile/tests/bench_1filezodb.py::bench_bigz_readhole    	0.42  (0.42 0.43 0.43)
    bigfile/tests/bench_1filezodb.py::bench_bigz_writeff     	0.84  (0.84 1.25 1.25)
    bigfile/tests/bench_1filezodb.py::bench_bigz_read        	0.60  (0.64 0.60 0.60)
    ========================== 14 passed in 21.78 seconds ==========================
    
    After patch:
    
    ============================= test session starts ==============================
    platform linux2 -- Python 2.7.14, pytest-3.3.0, py-1.5.2, pluggy-0.6.0
    rootdir: /home/kirr/src/wendelin/wendelin.core, inifile:
    collected 14 items
    
    pymod: bigfile/tests/bench_0virtmem.py
    bench_file_mmapread_hole	0.21  (0.39 0.22 0.21)
    bench_file_read_hole    	0.24  (0.24 0.24 0.24)
    bench_file_readbig_hole 	0.30  (0.30 0.30 0.30)
    bench_bigf_read_hole    	0.43  (0.43 0.43 0.43)
    bench_file_mmapwrite0   	0.12  (0.13 0.12 0.13)
    bench_file_write55      	0.08  (0.08 0.08 0.08)
    bench_bigf_writeff      	0.45  (0.52 0.51 0.45)
    bench_file_mmapread     	0.21  (0.21 0.21 0.21)
    bench_file_read         	0.24  (0.24 0.24 0.24)
    bench_file_readbig      	0.30  (0.30 0.30 0.30)
    bench_bigf_read         	0.43  (0.43 0.43 0.43)
    
    pymod: bigfile/tests/bench_1filezodb.py
    bench_bigz_readhole     	0.43  (0.43 0.43 0.43)
    bench_bigz_writeff      	0.83  (0.83 1.20 1.21)
    bench_bigz_read         	0.60  (0.65 0.60 0.60)
    
    ========================== 14 passed in 21.80 seconds ==========================
    
    The `key: value` header is compatible with Go benchmark format[1] and
    further we'll be trying to teach py.bench to output results in that
    format so that Go benchmarking tools like benchstat and perf.golang.org
    could be used for free.
    
    [1] https://github.com/golang/proposal/blob/master/design/14313-benchmark-format.md
    074ce24d
py.bench 6.59 KB