←back to thread

320 points willm | 1 comments | | HN request time: 0.2s | source
Show context
MichaelRazum ◴[] No.45106413[source]
You can’t just plug and play it. As soon as you introduce async you need to have the runtime loop and so on. Basically the whole architecture needs to be redesigned
replies(2): >>45106845 #>>45107320 #
whilenot-dev ◴[] No.45106845[source]
asyncio has been designed to be as "plug and play" as it gets. I'd discourage it, but one could create async loops wherever one would need them, one separate thread per loop, and adapt the code base in a more granular fashion. Blocking through the GIL will persist, though.

For any new app that is mostly IO constraint I'd still encourage the use of asyncio from the beginning.

replies(2): >>45109906 #>>45125308 #
1. MichaelRazum ◴[] No.45125308[source]
Sure agree, for bi directional websocket communication it is the way to go. It's just that you have to really think it thorough when using it. Like using asyncio.sleep instead of sleep for example and there are more little things that could easily hurt the performance and advantages of it.