Skip to content
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

perf: no need to decode bytes to str for json.loads #3389

Closed
wants to merge 2 commits into from

Conversation

trim21
Copy link

@trim21 trim21 commented Apr 25, 2024

In a old version of python, json.loads take str only. But in python >= 3.6, it can parse bytes directly.

So there is no need to decode body to str, just feed bytes to json.loads is fine, for python>=3.8.

https://docs.python.org/3.8/library/json.html#json.loads

@trim21
Copy link
Author

trim21 commented Apr 25, 2024

ci failed with a non relative tests

FAILED test/with_dummyserver/test_connectionpool.py::TestConnectionPoolTimeouts::test_timeout - AssertionError: timeout was pool-level SHORT_TIMEOUT rather than request-level LONG_TIMEOUT

@sigmavirus24
Copy link
Contributor

Please provide performance benchmarking to justify this

@trim21
Copy link
Author

trim21 commented Apr 26, 2024

you are right, benchmark says no such thing

@trim21 trim21 closed this Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants