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

[PR #9499/b45a7dab backport][3.11] Improve performance of creating the ConnectionKey #9500

Conversation

patchback[bot]
Copy link
Contributor

@patchback patchback bot commented Oct 18, 2024

This is a backport of PR #9499 as merged into master (b45a7da).

What do these changes do?

Improve performance of the client by reducing the overhead to create the ConnectionKey objects.

Reuses the same idea as aio-libs/yarl#1316 and aio-libs/yarl#1322

Calling tuple.__new__ is much faster because it avoids the extra runtime lambda having to be run and arguments unpacked for every message https://github.com/python/cpython/blob/d83fcf8371f2f33c7797bc8f5423a8bca8c46e5c/Lib/collections/__init__.py#L441

This only works if the object being created is a NamedTuple so this speed up is only recommended internally and should not be used outside of aiohttp since we do not guarantee that ConnectionKey will remain a NamedTuple in the future.

Are there changes in behavior for the user?

no

Is it a substantial burden for the maintainers to support this?

no

@bdraco bdraco enabled auto-merge (squash) October 18, 2024 01:40
@bdraco bdraco closed this Oct 18, 2024
auto-merge was automatically disabled October 18, 2024 02:24

Pull request was closed

@bdraco bdraco reopened this Oct 18, 2024
@bdraco bdraco enabled auto-merge (squash) October 18, 2024 02:24
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.85%. Comparing base (50ad770) to head (ba22635).
Report is 3 commits behind head on 3.11.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             3.11    #9500   +/-   ##
=======================================
  Coverage   97.85%   97.85%           
=======================================
  Files         106      106           
  Lines       35211    35211           
  Branches     4227     4227           
=======================================
  Hits        34455    34455           
  Misses        564      564           
  Partials      192      192           
Flag Coverage Δ
CI-GHA 97.73% <100.00%> (ø)
OS-Linux 97.42% <100.00%> (-0.01%) ⬇️
OS-Windows 94.85% <100.00%> (ø)
OS-macOS 97.12% <100.00%> (ø)
Py-3.10.11 96.98% <100.00%> (+<0.01%) ⬆️
Py-3.10.15 96.92% <100.00%> (ø)
Py-3.11.10 97.00% <100.00%> (+0.01%) ⬆️
Py-3.11.9 97.06% <100.00%> (-0.02%) ⬇️
Py-3.12.7 97.46% <100.00%> (ø)
Py-3.13.0 97.45% <100.00%> (ø)
Py-3.9.13 96.90% <100.00%> (+<0.01%) ⬆️
Py-3.9.20 96.83% <100.00%> (ø)
Py-pypy7.3.16 96.45% <100.00%> (ø)
VM-macos 97.12% <100.00%> (ø)
VM-ubuntu 97.42% <100.00%> (-0.01%) ⬇️
VM-windows 94.85% <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 merged commit 9fd3aa1 into 3.11 Oct 18, 2024
47 of 64 checks passed
@bdraco bdraco deleted the patchback/backports/3.11/b45a7dab665e84a113bfbc6a261ef6e70d7887f8/pr-9499 branch October 18, 2024 02:50
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.

1 participant