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

Performance issue in TLS: assert that each written chunk of a data is not a str #12011

Closed
itamarst opened this issue Oct 10, 2023 · 3 comments · Fixed by #12090
Closed

Performance issue in TLS: assert that each written chunk of a data is not a str #12011

itamarst opened this issue Oct 10, 2023 · 3 comments · Fixed by #12090
Assignees
Labels

Comments

@itamarst
Copy link
Contributor

This check is in the hot path, and can slow down writing when there are lots of small writes:

if isinstance(bytes, str):

Fixing it will be done as followup to #11989

@itamarst itamarst added the bug label Oct 10, 2023
@itamarst itamarst self-assigned this Oct 10, 2023
@itamarst
Copy link
Contributor Author

itamarst commented Oct 12, 2023

I did some testing with latest code. On Python 3.11 there's no meaningful difference in performance; that is, there may be an impact, but it's overwhelmed by noise, so presumably not particularly significant. On Python 3.10 it's a small improvement. Insofar as this does make debugging easier, and insofar as there's no reason for people not to upgrade to Python 3.11 or later in general, this is probably unnecessary.

@adiroiban
Copy link
Member

Thanks for the follow up.
Happy to hear there is no significant performance impact.

@itamarst itamarst reopened this Jan 22, 2024
@itamarst
Copy link
Contributor Author

I did some more benchmarking and decided I was wrong, there is actually a meaningful performance impact. So I will submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants