Speed up coroutine creation ? #191
kumaraditya303
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
Can you test again, adding await or next()? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Please clarify, did you measure coroutine creation time or a time of raising RuntimeWarning? Looing on the script, I suspect the second. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Python version - Python 3.11.0a3+
Script:
Results:
Coroutine creation is atleast 5.7x slower than a generator which is very slow considering that in asyncio coroutine are created at very high rate.
Further investigation revealed that most of the slowness is due to tracking of coroutine if it was awaited or not:
Script:
Results:
If the created coroutine is closed so that its tracking feature does not track it then it is margin of error slower than generator, revealing that tracking coroutine is slowing it down.
Beta Was this translation helpful? Give feedback.
All reactions