Hi,
I released the version 0.9.4 of my Python perf module:
- Add --compare-to option to the Runner CLI
- compare_to command: Add --table option to render a table
http://perf.readthedocs.io/en/latest/
I used the --table feature to write this FASTCALL microbenchmarks article: https://haypo.github.io/fastcall-microbenchmarks.html
Example:
+---------------------+---------+------------------------------+ | Benchmark | 3.5 | 3.7 | +=====================+=========+==============================+ | struct.pack("i", 1) | 105 ns | 77.6 ns: 1.36x faster (-26%) | +---------------------+---------+------------------------------+ | getattr(1, "real") | 79.4 ns | 64.4 ns: 1.23x faster (-19%) | +---------------------+---------+------------------------------+
Use --quiet for smaller table.
The --compare-to command is the generalization to any perf script of the existing perf timeit --compare-to option, to quickly compare two Python binaries.
Example with timeit (because I'm too lazy to write a perf script!):
$ ./python -m perf timeit 'int(0)' --duplicate=100 --compare-to ../master-ref/python -p3 /home/haypo/prog/bench_python/master-ref/python: .... 112 ns +- 1 ns /home/haypo/prog/bench_python/master/python: .... 108 ns +- 1 ns
Median +- std dev: [/home/haypo/prog/bench_python/master-ref/python] 112 ns +- 1 ns -> [/home/haypo/prog/bench_python/master/python] 108 ns +- 1 ns: 1.04x faster (-3%)
Hum, I should write an option to allow to specify the name of python binaries, to replace [/home/haypo/prog/bench_python/master-ref/python] just with [ref].
Victor
participants (1)
-
Victor Stinner