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 URL to string #1234

Merged
merged 9 commits into from
Oct 13, 2024
Merged

Improve performance of converting URL to string #1234

merged 9 commits into from
Oct 13, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Oct 12, 2024

Not sure if this is worth it or not, but the string convert method are a bit higher than everything else

Seems like 71%-3x speed up is worth it

Calling urllib's urlunsplit was quite a bit more expensive than expected as seen in the benchmarks.

Copy link

codspeed-hq bot commented Oct 12, 2024

CodSpeed Performance Report

Merging #1234 will improve performances by ×3.1

Comparing unsplit (9a6a736) with master (91fd78c)

Summary

⚡ 3 improvements
✅ 35 untouched benchmarks

Benchmarks breakdown

Benchmark master unsplit Change
test_url_to_string 566.2 µs 329.5 µs +71.86%
test_url_with_path_to_string 573.1 µs 314.2 µs +82.43%
test_url_with_query_to_string 1,200.4 µs 381.1 µs ×3.1

Copy link

codecov bot commented Oct 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.78%. Comparing base (91fd78c) to head (9a6a736).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1234   +/-   ##
=======================================
  Coverage   95.78%   95.78%           
=======================================
  Files          27       27           
  Lines        5097     5106    +9     
  Branches      302      306    +4     
=======================================
+ Hits         4882     4891    +9     
  Misses        189      189           
  Partials       26       26           
Flag Coverage Δ
CI-GHA 95.76% <100.00%> (+<0.01%) ⬆️
MyPy 43.55% <100.00%> (+0.09%) ⬆️
OS-Linux 99.34% <100.00%> (+<0.01%) ⬆️
OS-Windows 99.40% <100.00%> (+<0.01%) ⬆️
OS-macOS 99.05% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 98.95% <100.00%> (+<0.01%) ⬆️
Py-3.10.15 99.22% <100.00%> (+<0.01%) ⬆️
Py-3.11.10 99.22% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 98.95% <100.00%> (+<0.01%) ⬆️
Py-3.12.7 99.22% <100.00%> (+<0.01%) ⬆️
Py-3.13.0 99.22% <100.00%> (+<0.01%) ⬆️
Py-3.8.10 98.91% <100.00%> (+<0.01%) ⬆️
Py-3.8.18 99.17% <100.00%> (+<0.01%) ⬆️
Py-3.9.13 98.91% <100.00%> (+<0.01%) ⬆️
Py-3.9.20 99.17% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.11 99.23% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.16 99.23% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.17 99.25% <100.00%> (+<0.01%) ⬆️
VM-macos-latest 99.05% <100.00%> (+<0.01%) ⬆️
VM-ubuntu-latest 99.34% <100.00%> (+<0.01%) ⬆️
VM-windows-latest 99.40% <100.00%> (+<0.01%) ⬆️
pytest 99.34% <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 force-pushed the unsplit branch 2 times, most recently from 5b1ff3f to 1ec700d Compare October 12, 2024 23:12
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 Oct 13, 2024
@bdraco bdraco marked this pull request as ready for review October 13, 2024 00:15
@bdraco bdraco merged commit 5541cdb into master Oct 13, 2024
49 of 51 checks passed
@bdraco bdraco deleted the unsplit branch October 13, 2024 00:15
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