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

Add a fast path for URL construction when the netloc is the host #1271

Merged
merged 7 commits into from
Oct 15, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Oct 15, 2024

Connecting to a non-default port, providing a username, or password in the URL is a less likely case. Optimize for the common case.

Copy link

codspeed-hq bot commented Oct 15, 2024

CodSpeed Performance Report

Merging #1271 will improve performances by 16.51%

Comparing fast_path_netloc_is_host (0e85efe) with master (ca9f47a)

Summary

⚡ 11 improvements
✅ 36 untouched benchmarks

Benchmarks breakdown

Benchmark master fast_path_netloc_is_host Change
test_url_build_access_fragment 939.2 µs 852.8 µs +10.12%
test_url_build_access_raw_host 1,085.5 µs 991.7 µs +9.45%
test_url_build_access_raw_path 1,081 µs 995.5 µs +8.58%
test_url_build_with_different_hosts 2.6 ms 2.3 ms +16.51%
test_url_build_with_host 807.5 µs 714.5 µs +13.01%
test_url_make_access_fragment 978.4 µs 881 µs +11.06%
test_url_make_access_raw_host 883.6 µs 791.6 µs +11.62%
test_url_make_access_raw_path 1.1 ms 1 ms +9.27%
test_url_make_with_host_and_path 845.3 µs 759.7 µs +11.27%
test_url_make_with_ipv4_address_and_path 1,076.5 µs 982.4 µs +9.59%
test_url_make_with_ipv6_address_and_path 1.2 ms 1.1 ms +9.39%

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.72%. Comparing base (ca9f47a) to head (0e85efe).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1271   +/-   ##
=======================================
  Coverage   95.72%   95.72%           
=======================================
  Files          27       27           
  Lines        5188     5196    +8     
  Branches      299      302    +3     
=======================================
+ Hits         4966     4974    +8     
  Misses        195      195           
  Partials       27       27           
Flag Coverage Δ
CI-GHA 95.72% <100.00%> (+<0.01%) ⬆️
MyPy 44.01% <100.00%> (+0.09%) ⬆️
OS-Linux 99.28% <100.00%> (+<0.01%) ⬆️
OS-Windows 99.34% <100.00%> (+<0.01%) ⬆️
OS-macOS 99.00% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 98.97% <100.00%> (+<0.01%) ⬆️
Py-3.10.15 99.24% <100.00%> (+<0.01%) ⬆️
Py-3.11.10 99.24% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 98.97% <100.00%> (+<0.01%) ⬆️
Py-3.12.7 99.24% <100.00%> (+<0.01%) ⬆️
Py-3.13.0 99.24% <100.00%> (+<0.01%) ⬆️
Py-3.9.13 98.93% <100.00%> (+<0.01%) ⬆️
Py-3.9.20 99.19% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.16 99.24% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.17 99.27% <100.00%> (+<0.01%) ⬆️
VM-macos-latest 99.00% <100.00%> (+<0.01%) ⬆️
VM-ubuntu-latest 99.28% <100.00%> (+<0.01%) ⬆️
VM-windows-latest 99.34% <100.00%> (+<0.01%) ⬆️
pytest 99.28% <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 changed the title Add a fast path for making unencoded URLs when the netloc is the host Add a fast path for URL construction when the netloc is the host Oct 15, 2024
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 15, 2024
@bdraco bdraco marked this pull request as ready for review October 15, 2024 06:32
@bdraco bdraco merged commit 598cc0c into master Oct 15, 2024
43 of 46 checks passed
@bdraco bdraco deleted the fast_path_netloc_is_host branch October 15, 2024 06:32
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