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 converting a URL to a string #1422

Merged
merged 3 commits into from
Nov 19, 2024
Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Nov 19, 2024

The or "" check was not needed. Avoid one branch and string copy for the common case where scheme is set.

Copy link

codspeed-hq bot commented Nov 19, 2024

CodSpeed Performance Report

Merging #1422 will improve performances by 12.04%

Comparing url_to_str (65269fc) with master (b31eaa1)

Summary

⚡ 3 improvements
✅ 82 untouched benchmarks

Benchmarks breakdown

Benchmark master url_to_str Change
test_url_to_string 245.1 µs 218.7 µs +12.04%
test_url_with_path_to_string 264.8 µs 237.8 µs +11.36%
test_url_with_query_to_string 301.3 µs 275.3 µs +9.47%

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 19, 2024
@bdraco bdraco marked this pull request as ready for review November 19, 2024 04:02
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.06%. Comparing base (b31eaa1) to head (65269fc).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1422   +/-   ##
=======================================
  Coverage   96.06%   96.06%           
=======================================
  Files          31       31           
  Lines        5774     5774           
  Branches      348      348           
=======================================
  Hits         5547     5547           
  Misses        201      201           
  Partials       26       26           
Flag Coverage Δ
CI-GHA 96.06% <100.00%> (ø)
MyPy 48.69% <100.00%> (ø)
OS-Linux 99.55% <100.00%> (ø)
OS-Windows 99.62% <100.00%> (ø)
OS-macOS 99.30% <100.00%> (ø)
Py-3.10.11 99.28% <100.00%> (ø)
Py-3.10.15 99.51% <100.00%> (ø)
Py-3.11.10 99.51% <100.00%> (ø)
Py-3.11.9 99.28% <100.00%> (ø)
Py-3.12.7 99.51% <100.00%> (ø)
Py-3.13.0 99.51% <100.00%> (ø)
Py-3.9.13 99.24% <100.00%> (ø)
Py-3.9.20 99.47% <100.00%> (ø)
Py-pypy7.3.16 99.53% <100.00%> (ø)
Py-pypy7.3.17 99.55% <100.00%> (ø)
VM-macos-latest 99.30% <100.00%> (ø)
VM-ubuntu-latest 99.55% <100.00%> (ø)
VM-windows-latest 99.62% <100.00%> (ø)
pytest 99.55% <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.


🚨 Try these New Features:

@bdraco bdraco merged commit b07cbb8 into master Nov 19, 2024
45 of 47 checks passed
@bdraco bdraco deleted the url_to_str branch November 19, 2024 04:10
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