[issue31350] asyncio: Optimize get_event_loop and _get_running_loop

Yury Selivanov report at bugs.python.org
Tue Sep 5 14:27:25 EDT 2017


Yury Selivanov added the comment:

> I'm not convinced that the PR is worth it. 3% is not interesting on a micro benchmark.

I found a small issue in the PR (left a comment in the PR).

I think using a tuple is still a good idea (even if the speedup is tiny) because logically, both attributes on that threading.local() object are always set and read at the same time.  Essentially, it's a pair of (loop, pid), so using a tuple here makes the code easier to reason about.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31350>
_______________________________________


More information about the Python-bugs-list mailing list