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

Improve performance of building URLs with authority #1163

Merged
merged 5 commits into from
Sep 27, 2024
Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Sep 27, 2024

What do these changes do?

Use the fast _split_netloc method so we do not have to reparse the netloc for every property.

Previously we called each SplitResult property which meant each property call has to reparse the netloc every time. Only do it once

Are there changes in behavior for the user?

no

Related issue number

aio-libs/aiohttp#9309 (comment) will call URL.build with authority much more often in a performance sensitive path.

Use the fast _split_netloc method so we do not have to reparse the netloc
for every property
Use the fast _split_netloc method so we do not have to reparse the netloc
for every property
yarl/_url.py Show resolved Hide resolved
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Sep 27, 2024
@bdraco
Copy link
Member Author

bdraco commented Sep 27, 2024

Verified new tests pass on master as well so we have bug for bug compat with the faster version

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.56%. Comparing base (38ef0f9) to head (d3d61c5).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1163      +/-   ##
==========================================
+ Coverage   95.54%   95.56%   +0.01%     
==========================================
  Files          30       30              
  Lines        4892     4911      +19     
  Branches      446      446              
==========================================
+ Hits         4674     4693      +19     
  Misses        192      192              
  Partials       26       26              
Flag Coverage Δ
CI-GHA 95.52% <100.00%> (+0.01%) ⬆️
MyPy 42.23% <31.81%> (-0.09%) ⬇️
OS-Linux 99.41% <100.00%> (+<0.01%) ⬆️
OS-Windows 99.50% <100.00%> (+<0.01%) ⬆️
OS-macOS 99.13% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 99.02% <100.00%> (+<0.01%) ⬆️
Py-3.10.15 99.25% <100.00%> (+<0.01%) ⬆️
Py-3.11.10 99.25% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 99.02% <100.00%> (+<0.01%) ⬆️
Py-3.12.6 99.25% <100.00%> (+<0.01%) ⬆️
Py-3.13.0-rc.2 99.25% <100.00%> (+<0.01%) ⬆️
Py-3.8.10 98.97% <100.00%> (+<0.01%) ⬆️
Py-3.8.18 99.20% <100.00%> (+<0.01%) ⬆️
Py-3.9.13 98.97% <100.00%> (+<0.01%) ⬆️
Py-3.9.20 99.20% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.11 99.26% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.16 99.26% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.17 99.29% <100.00%> (+<0.01%) ⬆️
VM-macos-latest 99.13% <100.00%> (+<0.01%) ⬆️
VM-ubuntu-latest 99.41% <100.00%> (+<0.01%) ⬆️
VM-windows-latest 99.50% <100.00%> (+<0.01%) ⬆️
pytest 99.41% <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 September 27, 2024 18:32
@bdraco
Copy link
Member Author

bdraco commented Sep 27, 2024

I'm going to do a new release of yarl before we publish a new aiohttp with aio-libs/aiohttp#9309 (comment) fixed

@bdraco bdraco merged commit 07b2e84 into master Sep 27, 2024
47 of 49 checks passed
@bdraco bdraco deleted the authority_slow branch September 27, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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