classification
Title: Implement asyncio._get_running_loop() and get_event_loop() in C
Type: performance Stage: resolved
Components: asyncio Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: yselivanov Nosy List: asvetlov, lukasz.langa, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2017-12-12 22:59 by yselivanov, last changed 2018-01-23 20:10 by yselivanov. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4827 merged yselivanov, 2017-12-12 23:01
PR 4850 merged yselivanov, 2017-12-13 21:38
PR 5277 merged yselivanov, 2018-01-23 05:42
Messages (6)
msg308169 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2017-12-12 22:59
asyncio.get_event_loop(), and, subsequently asyncio._get_running_loop() are one of the most frequently executed functions in asyncio.  They also can't be sped up by third-party event loops like uvloop.

When implemented in C they become 4x faster.
msg308237 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2017-12-13 19:49
New changeset a70232f28882d2fecb3ebe06643867701016070f by Yury Selivanov in branch 'master':
bpo-32296: Implement asyncio.get_event_loop and _get_running_loop in C. (#4827)
https://github.com/python/cpython/commit/a70232f28882d2fecb3ebe06643867701016070f
msg308247 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-12-13 20:59
Hum, sometimes it's better to wait for AppVeyor :-) You broke all Windows buildbots! :-) Example:

http://buildbot.python.org/all/#/builders/40/builds/278

======================================================================
ERROR: test_get_event_loop_returns_running_loop (test.test_asyncio.test_events.TestCGetEventLoop)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_asyncio\test_events.py", line 2738, in setUp
    watcher = asyncio.SafeChildWatcher()
AttributeError: module 'asyncio' has no attribute 'SafeChildWatcher'
======================================================================
ERROR: test_get_event_loop_returns_running_loop (test.test_asyncio.test_events.TestPyGetEventLoop)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_asyncio\test_events.py", line 2738, in setUp
    watcher = asyncio.SafeChildWatcher()
AttributeError: module 'asyncio' has no attribute 'SafeChildWatcher'
msg308253 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2017-12-13 21:39
Thanks Victor.  I've made a PR to fix this.
msg308261 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2017-12-13 22:28
New changeset bfbf04ef18c93ca8cab0453f76aeea1d8fc23fb1 by Yury Selivanov in branch 'master':
bpo-32296: Unbreak tests on Windows (#4850)
https://github.com/python/cpython/commit/bfbf04ef18c93ca8cab0453f76aeea1d8fc23fb1
msg310520 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-01-23 20:10
New changeset 9d411c119fdd8e42209ec16be27686a843507f18 by Yury Selivanov in branch 'master':
bpo-32296: Make get_running_loop() another 4-5x faster (#5277)
https://github.com/python/cpython/commit/9d411c119fdd8e42209ec16be27686a843507f18
History
Date User Action Args
2018-01-23 20:10:05yselivanovsetmessages: + msg310520
2018-01-23 05:42:17yselivanovsetpull_requests: + pull_request5121
2017-12-18 10:56:09asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-12-13 22:28:43yselivanovsetmessages: + msg308261
2017-12-13 21:39:20yselivanovsetmessages: + msg308253
2017-12-13 21:38:57yselivanovsetstage: resolved -> patch review
pull_requests: + pull_request4739
2017-12-13 20:59:07vstinnersetstatus: closed -> open

nosy: + vstinner
messages: + msg308247

resolution: fixed -> (no value)
2017-12-13 19:50:10yselivanovsetstatus: open -> closed
type: performance
resolution: fixed
stage: patch review -> resolved
2017-12-13 19:49:44yselivanovsetmessages: + msg308237
2017-12-12 23:01:47yselivanovsetkeywords: + patch
stage: patch review
pull_requests: + pull_request4719
2017-12-12 22:59:23yselivanovcreate