Author yselivanov
Recipients Liran Nuna, serhiy.storchaka, yselivanov
Date 2017-12-03.15:18:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In general, implementing coroutines using 'yield' expressions (not 'yield from'!) is slower than async/await, because the former approach needs a trampoline to manage the stack, whereas CPython itself handles that for 'yield from' and 'await'.  I suspect that any difference in performance is not related to 'async/await' vs 'yield' performance.

The attached benchmarks compare two completely different frameworks: asyncio and asynq.  Both have different implementations of Task and Future and event loops primitives.  Perhaps both of them schedule IO events and callbacks differently as well.

asyncio could be slower because all tasks' callbacks must be scheduled through the event loop, whereas some frameworks like Twisted schedule them right away, which makes them faster in some specific micro-benchmarks.  Or there might be an issue with 'asyncio.gather()', which is stressed heavily in the attached benchmarks.

What I can say for sure, is that Python implementation of async/await has nothing to do with the results you observe.

I suggest to take a look at 'asyncio.gather', maybe we can make it faster.  Please open a new issue if you find any ways to make it faster.
Date User Action Args
2017-12-03 15:18:02yselivanovsetrecipients: + yselivanov, serhiy.storchaka, Liran Nuna
2017-12-03 15:18:02yselivanovsetmessageid: <>
2017-12-03 15:18:02yselivanovlinkissue32204 messages
2017-12-03 15:18:02yselivanovcreate