-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Big overhead when mocking 149 urls #90
Comments
This is really useful findings! You're mentioning It would be interesting to see if the flamegraph looks different with respx master and latest httpx. |
Yep, thats pretty much the same ;-) It's interesting that Not sure what we can do at this moment. Caching objects for reuse in probably not an option since the request content could be a stream that we can't/shouldn't exhaust, meaning its hard to build a hash cache key. And even if possible, it's probably not being sent lots of same requests anyways. FYI, respx works with the This is why the |
Could you clone respx and add a About the matching-side, I looked at the code and we could easily move the instatiation of |
Also, please try #91 that enhances request usage in callbacks. |
With master:
With
With #91:
That one looks much better already! |
With #92:
|
Super! Will merge both PR's soon. |
RESPX Thanks @SlavaSkvortsov for helping closing this issue. |
I'm currently migrating from aiohttp/aioresponses to httpx/respx, and seeing a large regression in test times. An integration test where I mock 149 urls which took 0.5s with aioresponses now takes 2.2s with respx.
build_request
seems to be the major culprit. I've created a flamegraph with py-spy (full svg as gist):Test code
The text was updated successfully, but these errors were encountered: