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 generating query strings from mappings that contain sequences #1193

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Oct 11, 2024

Roughly a 10% speed up for the tuple/list case, 5% speed up for the non sequence case

baseline

Make URL with query mapping: 0.364 sec
Make URL with query sequence mapping: 2.121 sec

this pr

Make URL with query mapping: 0.345 sec
Make URL with query sequence mapping: 1.831 sec

yarl/_url.py Fixed Show fixed Hide fixed
yarl/_url.py Show resolved Hide resolved
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.59%. Comparing base (b36e63a) to head (d3cf9d4).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1193      +/-   ##
==========================================
- Coverage   95.59%   95.59%   -0.01%     
==========================================
  Files          25       25              
  Lines        4879     4878       -1     
  Branches      262      260       -2     
==========================================
- Hits         4664     4663       -1     
  Misses        189      189              
  Partials       26       26              
Flag Coverage Δ
CI-GHA 95.57% <100.00%> (-0.01%) ⬇️
MyPy 42.43% <100.00%> (ø)
OS-Linux 99.38% <100.00%> (-0.01%) ⬇️
OS-Windows 99.45% <100.00%> (-0.01%) ⬇️
OS-macOS 99.07% <100.00%> (-0.01%) ⬇️
Py-3.10.11 98.97% <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 98.97% <100.00%> (-0.01%) ⬇️
Py-3.12.7 99.25% <100.00%> (-0.01%) ⬇️
Py-3.13.0 99.25% <100.00%> (-0.01%) ⬇️
Py-3.8.10 98.92% <100.00%> (-0.01%) ⬇️
Py-3.8.18 99.20% <100.00%> (-0.01%) ⬇️
Py-3.9.13 98.92% <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.07% <100.00%> (-0.01%) ⬇️
VM-ubuntu-latest 99.38% <100.00%> (-0.01%) ⬇️
VM-windows-latest 99.45% <100.00%> (-0.01%) ⬇️
pytest 99.38% <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 closed this Oct 11, 2024
@bdraco bdraco reopened this Oct 11, 2024
@bdraco bdraco closed this Oct 11, 2024
@bdraco bdraco reopened this Oct 11, 2024
@bdraco
Copy link
Member Author

bdraco commented Oct 11, 2024

master + this PR

Build URL with host and path and port: 0.122 sec
Build encoded URL with host and path and port: 0.070 sec
Build URL with host: 0.081 sec
Build URL with different hosts: 0.143 sec
Build URL with host and port: 0.085 sec
Make URL with host and path and port: 0.086 sec
Make encoded URL with host and path and port: 0.023 sec
Make URL with host and path: 0.086 sec
Make URL with many hosts: 0.243 sec
Make URL with IPv4 Address and path and port: 0.089 sec
Make URL with IPv4 Address and path: 0.090 sec
Make URL with IPv6 Address and path and port: 0.101 sec
Make URL with IPv6 Address and path: 0.102 sec
Make URL with query mapping: 0.345 sec
Make URL with query sequence mapping: 1.831 sec

1.14.0

Build URL with host and path and port: 0.118 sec
Build encoded URL with host and path and port: 0.073 sec
Build URL with host: 0.088 sec
Build URL with different hosts: 0.123 sec
Build URL with host and port: 0.095 sec
Make URL with host and path and port: 0.111 sec
Make encoded URL with host and path and port: 0.023 sec
Make URL with host and path: 0.104 sec
Make URL with many hosts: 0.233 sec
Make URL with IPv4 Address and path and port: 0.109 sec
Make URL with IPv4 Address and path: 0.104 sec
Make URL with IPv6 Address and path and port: 0.122 sec
Make URL with IPv6 Address and path: 0.114 sec
Make URL with query mapping: 0.352 sec
Make URL with query sequence mapping: 2.023 sec

1.9.4

Build URL with host and path and port: 0.315 sec
Build encoded URL with host and path and port: 0.075 sec
Build URL with host: 0.246 sec
Build URL with different hosts: 0.264 sec
Build URL with host and port: 0.276 sec
Make URL with host and path and port: 0.345 sec
Make encoded URL with host and path and port: 0.023 sec
Make URL with host and path: 0.325 sec
Make URL with many hosts: 0.435 sec
Make URL with IPv4 Address and path and port: 0.331 sec
Make URL with IPv4 Address and path: 0.309 sec
Make URL with IPv6 Address and path and port: 0.511 sec
Make URL with IPv6 Address and path: 0.489 sec
Make URL with query mapping: 0.364 sec
Make URL with query sequence mapping: 2.121 sec

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 11, 2024
@bdraco bdraco marked this pull request as ready for review October 11, 2024 22:36
@bdraco bdraco merged commit f11ca20 into master Oct 11, 2024
47 of 49 checks passed
@bdraco bdraco deleted the tup branch October 11, 2024 22:41
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