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

Switch WebSocketWriter to use removesuffix to drop compression trailer #9795

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Nov 11, 2024

Now that Python 3.8 is no longer supported (master and 3.11 only) we can use bytes.removesuffix

This also takes care of one uncovered branch in the tests and brings the WebSocketWriter up to 100% line/branch coverage

Its small improvement, considering how much time the compression actually takes. It will be >10% if using isal for compression though since the compression overhead is far less when using alternative zlib see #9798
Screenshot 2024-11-11 at 8 31 43 AM

@bdraco bdraco added bot:chronographer:skip This PR does not need to include a change note backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot labels Nov 11, 2024
Copy link

codspeed-hq bot commented Nov 11, 2024

CodSpeed Performance Report

Merging #9795 will not alter performance

Comparing websocket_writer_ref (3c6d870) with master (d40b183)

Summary

✅ 17 untouched benchmarks

Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.69%. Comparing base (d40b183) to head (3c6d870).
Report is 2 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9795   +/-   ##
=======================================
  Coverage   98.69%   98.69%           
=======================================
  Files         118      118           
  Lines       36007    36004    -3     
  Branches     4281     4280    -1     
=======================================
- Hits        35536    35534    -2     
  Misses        316      316           
+ Partials      155      154    -1     
Flag Coverage Δ
CI-GHA 98.58% <100.00%> (+<0.01%) ⬆️
OS-Linux 98.26% <100.00%> (+<0.01%) ⬆️
OS-Windows 96.04% <100.00%> (+<0.01%) ⬆️
OS-macOS 97.34% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 97.18% <100.00%> (+<0.01%) ⬆️
Py-3.10.15 97.74% <100.00%> (+<0.01%) ⬆️
Py-3.11.10 97.78% <100.00%> (-0.01%) ⬇️
Py-3.11.9 97.24% <100.00%> (+0.01%) ⬆️
Py-3.12.7 98.33% <100.00%> (-0.01%) ⬇️
Py-3.13.0 98.31% <100.00%> (-0.01%) ⬇️
Py-3.9.13 97.10% <100.00%> (+<0.01%) ⬆️
Py-3.9.20 97.66% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.16 97.28% <100.00%> (+<0.01%) ⬆️
VM-macos 97.34% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 98.26% <100.00%> (+<0.01%) ⬆️
VM-windows 96.04% <100.00%> (+<0.01%) ⬆️

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.

@bdraco
Copy link
Member Author

bdraco commented Nov 11, 2024

We have no benchmark for compression.

We need to add that before considering this change

Now that Python 3.8 is no longer supported we can use removesuffix
@bdraco bdraco marked this pull request as ready for review November 11, 2024 14:32
@bdraco bdraco changed the title Switch WebSocketWriter to use removesuffix Switch WebSocketWriter to use removesuffix Nov 11, 2024
@bdraco bdraco enabled auto-merge (squash) November 11, 2024 14:32
@bdraco bdraco changed the title Switch WebSocketWriter to use removesuffix Switch WebSocketWriter to use removesuffix to drop compression trailer Nov 11, 2024
@bdraco bdraco merged commit fcb790b into master Nov 11, 2024
39 of 40 checks passed
@bdraco bdraco deleted the websocket_writer_ref branch November 11, 2024 14:52
Copy link
Contributor

patchback bot commented Nov 11, 2024

Backport to 3.11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.11/fcb790b12810cd823a1a138520152dd755f5b2bf/pr-9795

Backported as #9805

🤖 @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 Nov 11, 2024
bdraco added a commit that referenced this pull request Nov 11, 2024
…ovesuffix` to drop compression trailer (#9805)

Co-authored-by: J. Nick Koston <[email protected]>
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 bot:chronographer:skip This PR does not need to include a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant