[New-bugs-announce] [issue31350] Optimize get_event_loop and _get_running_loop
Jimmy Lai
report at bugs.python.org
Tue Sep 5 13:19:35 EDT 2017
New submission from Jimmy Lai:
get_event_loop() and _get_running_loop() can be faster.
Case Time Mean Improve
No Change 7.323 +- 0.172 7.323 0.00%
Remove class _RunningLoop 6.513 +- 0.115 6.513 -11.06%
Expand _get_running_loop() inside get_event_loop() 5.851 +- 0.160 5.851 -20.10%
Use Tuple instead of two attributes 6.179 +- 0.099 6.179 -15.62%
Tuple + Remove _RunningLoop 6.026 +- 0.123 6.026 -17.71%
Tuple + return ternary + Remove _RunningLoop 6.060 +- 0.111 6.06 -17.25%
Combine all four optimizations 4.735 +- 0.111 4.735 -35.34%
Remove class _RunningLoop + Use Tuple instead of two attributes 6.241 +- 0.097 6.241 -14.78%
Experimenting with different techniques to optimize get_event_loop and _get_running_loop.
After discuss with Yuri, decide not to expand _get_running_loop inside get_event_loop.
Combine tuple in _running_loop and Remove _RunningLoop (just use threading.local) can achieve the best improvement: 17.71% faster.
----------
components: asyncio
messages: 301342
nosy: jimmylai, yselivanov
priority: normal
pull_requests: 3360
severity: normal
status: open
title: Optimize get_event_loop and _get_running_loop
versions: Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31350>
_______________________________________
More information about the New-bugs-announce
mailing list