Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue32348

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Optimize asyncio.Future schedule/add/remove callback
Type:Stage:resolved
Components:asyncioVersions:Python 3.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: yselivanovNosy List: asvetlov, yselivanov
Priority:normalKeywords:patch

Created on2017-12-16 23:50 byyselivanov, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
t.pyyselivanov,2017-12-18 01:22
Pull Requests
URLStatusLinkedEdit
PR 4907mergedyselivanov,2017-12-16 23:52
Messages (3)
msg308481 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-12-16 23:50
Key observation: 99.9% of the time Futures and Tasks have only one callback.  Currently we have a list of callbacks in each Future/Task.  We can avoid list object allocation if we add a field to store the first callback.  This way we'll only need to ever allocate the list if a Future/Task has more than one done callbacks.asyncio with the proposed patch applied shows that 3-6% better performance of an asyncio echo server implemented using asyncio.streams.  This benchmark involves quite a bit of other Python code, so this improvement is actually quite significant.The patch consists of:1. first callback / callbacks list refactoring.2. a free list implementation for Future.__await__ objects (which are created on almost all awaits in asyncio).3. a big cleanup of the code, ensuring that Future/Task are always initialized properly.
msg308502 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-12-18 01:19
New changeset1b7c11ff0ee3efafbf5b38c3c6f37de5d63efb81 by Yury Selivanov in branch 'master':bpo-32348: Optimize asyncio.Future schedule/add/remove callback. (#4907)https://github.com/python/cpython/commit/1b7c11ff0ee3efafbf5b38c3c6f37de5d63efb81
msg308503 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-12-18 01:22
The attached benchmark fromhttps://bugs.python.org/issue32204 shows that the updated Task is 15% faster.
History
DateUserActionArgs
2022-04-11 14:58:55adminsetgithub: 76529
2017-12-18 01:22:51yselivanovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-12-18 01:22:36yselivanovsetfiles: +t.py

messages: +msg308503
2017-12-18 01:19:50yselivanovsetmessages: +msg308502
2017-12-16 23:52:37yselivanovsetkeywords: +patch
stage: patch review
pull_requests: +pull_request4801
2017-12-16 23:50:13yselivanovcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp