Replies: 1 comment 1 reply
-
I strongly suspect that the reason for much of the delay is that anyio does a lot of work to impart Trio semantics on asyncio, which isn't built for that, and the additional work (workarounds …) don't exactly improve performance. So httpx now has an asyncio backend and a trio backend, right? Shrug I don't see there's much we can do about this. |
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
-
It's very unfortunate that HTTPX is replacing AnyIO for a native asyncio backend. They already had a native Trio backend.
Here are the discussions:
asyncio
backend encode/httpcore#930asyncio
synchronization instead ofanyio
encode/httpcore#922Unfortunately, improving AnyIO was not considered, AFAICS.
On the other hand, already having an abstraction for backends makes AnyIO somewhat redundant.
There's a discussion about lowering the overall cost of the AnyIO (#543). I don't know how much the approach discussed there would help, but I assume it would mostly help with the AnyIO backend as a whole.
What about the synchronization primitives? Where is the extra cost coming from? I doubt there's per-call backend dispatch (as there is with
anyio.sleep()
). Are the statistics the problem? Is the code just slower? Could we copy the code from asyncio for a cheap speed-up? Could we extend the asyncio primitives to get most of the benefit without adding more code?Beta Was this translation helpful? Give feedback.
All reactions