performance regression when sniffio is missing #1102
Unanswered
CedricCabessa
asked this question in
Potential Issue
Replies: 1 comment
|
as the fix is easy, I'm adding a PR #1103 Ready to rework it as maintainers see fit |
0 replies
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.
httpcore tries to import sniffio
Until recently, the import was successful as
anyiodepends onsniffioHowever, since agronholm/anyio#1021 it is not the case.
It doesn't change the behavior as we fallback to
asyncioHowever the cost of failing import is real (python doesn't cache failing import)
I suggest to move this import at module level like it is done for
triooranyioHere is a microbenchmark to observe the issue (I can open a PR with my patched code)
On my machine
As a workaround, we add
sniffioin our dependency even if we don't need it just to fix this issue.Anyone installing
httpcore[asyncio]withouttriowill suffer from this performance hit as soon as they move toanyio >= 4.11All reactions