STINNER Victor added the comment:

> I like logger_is_enabled_for.patch.

I prefer debug_flag.patch because it is faster than logger_is_enabled_for.patch 
(see msg208214). I would like to write the most efficient code for 
BaseEventLoop._run_once() because this function is the real core of asyncio and 
it is called very frequently.

Test attached event_loop_run_once.py script. On such dummy example, _run_once() 
is called 4 times.

Note: Thanks to the nice design of yield from, wrapper() doesn't add an extra 
call to _run_once()!


Please think also to Trollius (port of asyncio on Python 2) which uses yield 
instead of yield-from. The same example calls _run_once() 10 times! The wrapper 
itself uses 2 calls. I don't know yet if Trollius can be modified to call 
_run_once() less frequently. It may be hard to keep the scheduling fair between 
concurrent running tasks.

----------
Added file: http://bugs.python.org/file33495/event_loop_run_once.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20275>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to