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 calling len on the same data in the stream reader twice #10088

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Dec 2, 2024

This is trivial but it is noticeable in the profile.

before
before

after
after

@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 backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot labels Dec 2, 2024
@bdraco
Copy link
Member Author

bdraco commented Dec 2, 2024

I only found this because I was looking at function call counts..

I was trying to find why _release_connection is always called 4x per request

Screenshot 2024-12-01 at 6 57 37 PM

Copy link

codspeed-hq bot commented Dec 2, 2024

CodSpeed Performance Report

Merging #10088 will not alter performance

Comparing dupe_len_call_read_nowait_chunk (3ad907e) with master (ca193c7)

Summary

✅ 44 untouched benchmarks

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.76%. Comparing base (ca193c7) to head (3ad907e).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #10088   +/-   ##
=======================================
  Coverage   98.76%   98.76%           
=======================================
  Files         121      121           
  Lines       36866    36867    +1     
  Branches     4396     4396           
=======================================
+ Hits        36409    36410    +1     
  Misses        311      311           
  Partials      146      146           
Flag Coverage Δ
CI-GHA 98.64% <100.00%> (+<0.01%) ⬆️
OS-Linux 98.33% <100.00%> (+<0.01%) ⬆️
OS-Windows 96.18% <100.00%> (+<0.01%) ⬆️
OS-macOS 97.43% <100.00%> (-0.01%) ⬇️
Py-3.10.11 97.28% <100.00%> (-0.01%) ⬇️
Py-3.10.15 97.88% <100.00%> (+<0.01%) ⬆️
Py-3.11.10 97.86% <100.00%> (-0.01%) ⬇️
Py-3.11.9 97.33% <100.00%> (-0.02%) ⬇️
Py-3.12.7 98.39% <100.00%> (+<0.01%) ⬆️
Py-3.13.0 98.39% <100.00%> (+<0.01%) ⬆️
Py-3.9.13 97.21% <100.00%> (+<0.01%) ⬆️
Py-3.9.20 97.79% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.16 97.35% <100.00%> (-0.01%) ⬇️
VM-macos 97.43% <100.00%> (-0.01%) ⬇️
VM-ubuntu 98.33% <100.00%> (+<0.01%) ⬆️
VM-windows 96.18% <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 bdraco marked this pull request as ready for review December 2, 2024 01:02
@bdraco bdraco requested a review from asvetlov as a code owner December 2, 2024 01:02
@bdraco bdraco enabled auto-merge (squash) December 2, 2024 01:03
@bdraco bdraco merged commit 29c3ca9 into master Dec 2, 2024
39 of 40 checks passed
@bdraco bdraco deleted the dupe_len_call_read_nowait_chunk branch December 2, 2024 01:06
Copy link
Contributor

patchback bot commented Dec 2, 2024

Backport to 3.11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.11/29c3ca93a4d1793c60d33038151228962f8b6f78/pr-10088

Backported as #10090

🤖 @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 2, 2024
Copy link
Contributor

patchback bot commented Dec 2, 2024

Backport to 3.12: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.12/29c3ca93a4d1793c60d33038151228962f8b6f78/pr-10088

Backported as #10091

🤖 @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 2, 2024
bdraco added a commit that referenced this pull request Dec 2, 2024
…a in the stream reader twice (#10090)

Co-authored-by: J. Nick Koston <[email protected]>
bdraco added a commit that referenced this pull request Dec 2, 2024
…a in the stream reader twice (#10091)

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 backport-3.12 Trigger automatic backporting to the 3.12 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