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

Make MESSAGE_TYPES_WITH_CONTENT a frozenset for the WebSocketReader #8747

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Aug 19, 2024

followup #8736 (comment)

frozenset is a tiny bit faster than the tuple

0.013342750000447268 vs 0.018335040998863406

from aiohttp.http_websocket import WSMsgType

import timeit
FZ = frozenset({WSMsgType.BINARY,WSMsgType.TEXT,WSMsgType.CONTINUATION})
TUP = (WSMsgType.BINARY,WSMsgType.TEXT,WSMsgType.CONTINUATION)

print (timeit.timeit("WSMsgType.TEXT in FZ", globals=locals()))
print (timeit.timeit("WSMsgType.TEXT in TUP", globals=locals()))

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Aug 19, 2024
@bdraco bdraco added backport-3.10 backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot labels Aug 19, 2024
@bdraco bdraco changed the title Make MESSAGE_TYPES_WITH_CONTENT a frozenset Make MESSAGE_TYPES_WITH_CONTENT a frozenset for the WebSocketReader Aug 19, 2024
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.14%. Comparing base (b4f9cb3) to head (b7faad2).
Report is 1031 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8747   +/-   ##
=======================================
  Coverage   98.13%   98.14%           
=======================================
  Files         107      107           
  Lines       34067    34067           
  Branches     4030     4030           
=======================================
+ Hits        33433    33435    +2     
+ Misses        457      456    -1     
+ Partials      177      176    -1     
Flag Coverage Δ
CI-GHA 98.04% <100.00%> (+<0.01%) ⬆️
OS-Linux 97.69% <100.00%> (ø)
OS-Windows 96.06% <100.00%> (ø)
OS-macOS 97.35% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 97.43% <100.00%> (ø)
Py-3.10.14 97.39% <100.00%> (ø)
Py-3.11.9 97.63% <100.00%> (+<0.01%) ⬆️
Py-3.12.4 97.73% <100.00%> (ø)
Py-3.8.10 95.70% <100.00%> (ø)
Py-3.8.18 97.20% <100.00%> (ø)
Py-3.9.13 97.33% <100.00%> (ø)
Py-3.9.19 97.29% <100.00%> (ø)
Py-pypy7.3.16 96.90% <100.00%> (ø)
VM-macos 97.35% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 97.69% <100.00%> (ø)
VM-windows 96.06% <100.00%> (ø)

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 bdraco marked this pull request as ready for review August 19, 2024 17:40
@bdraco bdraco enabled auto-merge (squash) August 19, 2024 17:42
@bdraco bdraco merged commit e97b17a into master Aug 19, 2024
38 of 39 checks passed
@bdraco bdraco deleted the websocket_fz branch August 19, 2024 17:52
Copy link
Contributor

patchback bot commented Aug 19, 2024

Backport to 3.10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.10/e97b17a6d0fc8b5d4c1f46822eed389724fee8f7/pr-8747

Backported as #8750

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

Copy link
Contributor

patchback bot commented Aug 19, 2024

Backport to 3.11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.11/e97b17a6d0fc8b5d4c1f46822eed389724fee8f7/pr-8747

Backported as #8751

🤖 @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 Aug 19, 2024
bdraco added a commit that referenced this pull request Aug 19, 2024
…frozenset for the WebSocketReader (#8750)

Co-authored-by: J. Nick Koston <nick@koston.org>
bdraco added a commit that referenced this pull request Aug 19, 2024
…frozenset for the WebSocketReader (#8751)

Co-authored-by: J. Nick Koston <nick@koston.org>
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: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