Repository navigation
performance regression when sniffio is missing #1102
Replies: 2 comments
|
as the fix is easy, I'm adding a PR #1103 Ready to rework it as maintainers see fit |
|
Confirming this, and it is much worse on Windows. Your benchmark unchanged, httpcore 1.0.9, anyio 4.16.0 (which no longer pulls
So ~8× rather than ~1.5×. The reason is that a failing Until #1103 lands, anyone who notices this can just add |
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