[issue31350] asyncio: Optimize get_event_loop and _get_running_loop
STINNER Victor
report at bugs.python.org
Tue Sep 5 14:14:51 EDT 2017
STINNER Victor added the comment:
I suggest to use my perf module to run benchmark, especially if the tested function takes less than 1 ms, which is the case here.
Attached benchmark script calls asyncio.get_event_loop(). Result on the master branch with PR 3347:
haypo at selma$ ./python ~/bench_asyncio.py --inherit=PYTHONPATH -o patch.json
haypo at selma$ ./python ~/bench_asyncio.py --inherit=PYTHONPATH -o ref.json
haypo at selma$ ./python -m perf compare_to ref.json patch.json
Mean +- std dev: [ref] 881 ns +- 42 ns -> [patch] 859 ns +- 14 ns: 1.03x faster (-3%)
I'm not convinced that the PR is worth it. 3% is not interesting on a micro benchmark.
Or is there an issue in my benchmark?
----------
Added file: http://bugs.python.org/file47120/bench_asyncio.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31350>
_______________________________________
More information about the Python-bugs-list
mailing list