You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the sync function is IO-intensive, asyncify would be great. But if the sync function is CPU-intensive, asyncify would not work because of GIL. For this situation, anyio offers to_process.
So my point is, if it is good to offer a bool arg use_thread in asyncify to make sure whether use to_thread or to_process? Or offer a new function asyncify_to_process? At lease I think now the doc should show that asyncify would be appropriate only when the sync function is IO-intensive.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
If I didn't see the second paragraph above, I would believe that any sync function could be asyncified by
asyncify
. So I read the code ofasyncify
Description
If the sync function is IO-intensive,
asyncify
would be great. But if the sync function is CPU-intensive,asyncify
would not work because of GIL. For this situation,anyio
offersto_process
.So my point is, if it is good to offer a bool arg
use_thread
inasyncify
to make sure whether useto_thread
orto_process
? Or offer a new functionasyncify_to_process
? At lease I think now the doc should show thatasyncify
would be appropriate only when the sync function is IO-intensive.Operating System
Linux
Operating System Details
No response
asyncer Version
0.0.7
Python Version
3.10.12
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions