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

Improve performance of parsing headers #10073

Merged
merged 9 commits into from
Dec 1, 2024
Merged

Improve performance of parsing headers #10073

merged 9 commits into from
Dec 1, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Nov 29, 2024

After we have a complete header we always have to convert it to a new bytes object. For almost every case we get the header in a single read. In this case its much faster to convert to bytes once. If the header gets split across multiple reads it will be a bit slower but this is the uncommon case.

Screenshot 2024-12-01 at 3 13 50 PM

Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.76%. Comparing base (0d6a83e) to head (ebafbb4).
Report is 2 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #10073   +/-   ##
=======================================
  Coverage   98.76%   98.76%           
=======================================
  Files         121      121           
  Lines       36860    36860           
  Branches     4396     4396           
=======================================
  Hits        36403    36403           
  Misses        311      311           
  Partials      146      146           
Flag Coverage Δ
CI-GHA 98.64% <ø> (ø)
OS-Linux 98.33% <ø> (ø)
OS-Windows 96.18% <ø> (ø)
OS-macOS 97.43% <ø> (ø)
Py-3.10.11 97.29% <ø> (+<0.01%) ⬆️
Py-3.10.15 97.88% <ø> (+0.05%) ⬆️
Py-3.11.10 97.88% <ø> (+<0.01%) ⬆️
Py-3.11.9 97.34% <ø> (+0.01%) ⬆️
Py-3.12.7 98.39% <ø> (ø)
Py-3.13.0 98.39% <ø> (+<0.01%) ⬆️
Py-3.9.13 97.21% <ø> (ø)
Py-3.9.20 97.74% <ø> (-0.05%) ⬇️
Py-pypy7.3.16 97.36% <ø> (ø)
VM-macos 97.43% <ø> (ø)
VM-ubuntu 98.33% <ø> (ø)
VM-windows 96.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codspeed-hq bot commented Nov 29, 2024

CodSpeed Performance Report

Merging #10073 will not alter performance

Comparing find_header_perf (ebafbb4) with master (0d6a83e)

Summary

✅ 44 untouched benchmarks

@bdraco bdraco added backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot labels Nov 29, 2024
@bdraco bdraco changed the title DNM: Attempt to improve performance of parsing headers Improve performance of parsing headers Nov 29, 2024
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 29, 2024
@bdraco bdraco marked this pull request as ready for review November 30, 2024 01:17
@bdraco bdraco enabled auto-merge (squash) December 1, 2024 21:15
@bdraco bdraco merged commit 349b756 into master Dec 1, 2024
37 checks passed
@bdraco bdraco deleted the find_header_perf branch December 1, 2024 21:26
Copy link
Contributor

patchback bot commented Dec 1, 2024

Backport to 3.11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.11/349b756592bd9baee4ef89e2ed9a770b2800cce5/pr-10073

Backported as #10083

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Dec 1, 2024
Copy link
Contributor

patchback bot commented Dec 1, 2024

Backport to 3.12: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.12/349b756592bd9baee4ef89e2ed9a770b2800cce5/pr-10073

Backported as #10084

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Dec 1, 2024
bdraco added a commit that referenced this pull request Dec 1, 2024
bdraco added a commit that referenced this pull request Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant