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

Avoid creating body writer task when there is no body #9757

Merged
merged 16 commits into from
Nov 10, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Nov 9, 2024

The client would create a task to write the body even if the body was b""

Since GET requests tend to be some of the most common, it makes sense to optimize for the case where only headers are sent.

aiohttp 3.11.0b4 yarl 1.17.1
aiohttp_3_11_0b4_yarl_1_17_1

This PR:
b5

@bdraco bdraco added the backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot label Nov 9, 2024
Copy link

codecov bot commented Nov 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.67%. Comparing base (44d809f) to head (20a015b).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9757   +/-   ##
=======================================
  Coverage   98.67%   98.67%           
=======================================
  Files         117      117           
  Lines       35896    35931   +35     
  Branches     4263     4267    +4     
=======================================
+ Hits        35420    35455   +35     
  Misses        320      320           
  Partials      156      156           
Flag Coverage Δ
CI-GHA 98.56% <97.82%> (+<0.01%) ⬆️
OS-Linux 98.24% <97.82%> (+<0.01%) ⬆️
OS-Windows 96.02% <97.82%> (+<0.01%) ⬆️
OS-macOS 97.32% <97.82%> (+<0.01%) ⬆️
Py-3.10.11 97.16% <91.30%> (+<0.01%) ⬆️
Py-3.10.15 97.72% <91.30%> (+<0.01%) ⬆️
Py-3.11.10 97.77% <91.30%> (+<0.01%) ⬆️
Py-3.11.9 97.21% <91.30%> (-0.01%) ⬇️
Py-3.12.7 98.31% <95.65%> (+<0.01%) ⬆️
Py-3.13.0 98.25% <95.65%> (-0.05%) ⬇️
Py-3.9.13 97.08% <91.30%> (+<0.01%) ⬆️
Py-3.9.20 97.68% <91.30%> (+<0.01%) ⬆️
Py-pypy7.3.16 97.25% <91.30%> (+<0.01%) ⬆️
VM-macos 97.32% <97.82%> (+<0.01%) ⬆️
VM-ubuntu 98.24% <97.82%> (+<0.01%) ⬆️
VM-windows 96.02% <97.82%> (+<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.

Copy link

codspeed-hq bot commented Nov 9, 2024

CodSpeed Performance Report

Merging #9757 will improve performances by 39.02%

Comparing no_task_no_body_to_Write (20a015b) with master (44d809f)

Summary

⚡ 1 improvements
✅ 13 untouched benchmarks

Benchmarks breakdown

Benchmark master no_task_no_body_to_Write Change
test_send_client_request_one_hundred[pyloop] 4.4 ms 3.2 ms +39.02%

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 10, 2024
aiohttp/client_reqrep.py Outdated Show resolved Hide resolved
@bdraco bdraco marked this pull request as ready for review November 10, 2024 00:45
@bdraco bdraco enabled auto-merge (squash) November 10, 2024 00:46
@bdraco bdraco merged commit b2c845b into master Nov 10, 2024
37 of 38 checks passed
@bdraco bdraco deleted the no_task_no_body_to_Write branch November 10, 2024 00:48
Copy link
Contributor

patchback bot commented Nov 10, 2024

Backport to 3.11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.11/b2c845bb22a4c4090b8312786085bdda5bad0b75/pr-9757

Backported as #9759

🤖 @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 10, 2024
bdraco added a commit that referenced this pull request Nov 10, 2024
…en there is no body (#9759)

Co-authored-by: J. Nick Koston <nick@koston.org>
@bdraco
Copy link
Member Author

bdraco commented Nov 12, 2024

This might have introduced a regression on sending an empty body with chunked.. although we likely have a guard to not do chunked with empty body I'm not sure its tested

@bdraco
Copy link
Member Author

bdraco commented Nov 12, 2024

nope, seems ok but will add a test

bdraco added a commit that referenced this pull request Nov 12, 2024
#9757 (comment)
I was worried 9757 might have introduced a regression but it appears
its fine. Add some coverage for this area to make sure we do not
introduce one in the future from refactoring
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