Repository navigation
|
In a small scraper I run, I noticed that the network process was continuously near 100% CPU use, even though it should have been network bound. During profiling, I noticed that the bottleneck is the cookie jar, highlighted in red:
SVG: https://gist.github.com/konstin/a85b7ba02fd8db8400533a7cffc09fea Following https://pydantic.dev/docs/httpx2/guides/async/#opening-and-closing-clients, I've been using one client for the scraper. It seems that the
As the cookies accumulate, this copy becomes slow. |
Answered by
Kludex
Oct 21, 2026
Replies: 1 comment 4 replies
|
It seems there's a performance issue in the the cookies library itself. I'll investigate more tomorrow. I have this PR open for the time being: #1285 |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

I've simplified the implementation. Now it's easy to understand for humans as well. 🙏
I've filled python/cpython#160027 on the CPython's side.
The performance improvement is now available in httpx2 2.16.0.
@konstin Thanks for your work on uv! ❤️