Skip to content

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Nov 17, 2024

  • Avoid the slice for the common cases
  • Avoid creating new lists
  • Avoid reversing as long as possible so we do not have to insert at the front or create a new list since insert at 0 has O(n) time complexity, and append has O(1) time complexity

Copy link

codecov bot commented Nov 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.06%. Comparing base (14c3759) to head (8e5d0b4).
Report is 40 commits behind head on master.

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

Copy link

codspeed-hq bot commented Nov 17, 2024

CodSpeed Performance Report

Merging #1418 will improve performances by 21.15%

Comparing joinpath_perf (8e5d0b4) with master (14c3759)

Summary

⚡ 4 improvements
✅ 81 untouched benchmarks

Benchmarks breakdown

Benchmark master joinpath_perf Change
test_url_joinpath 787.1 µs 655.5 µs +20.08%
test_url_joinpath_encoded 745 µs 614.9 µs +21.15%
test_url_joinpath_encoded_long 1,090.7 µs 964.3 µs +13.1%
test_url_joinpath_with_truediv 879.1 µs 750.9 µs +17.08%

@bdraco bdraco changed the title DNM: attempt to speed up joinpath Improve performances of joinpath Nov 17, 2024
@bdraco bdraco changed the title Improve performances of joinpath Improve performances of URL.joinpath Nov 17, 2024
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 17, 2024
@bdraco bdraco marked this pull request as ready for review November 17, 2024 16:04
@bdraco bdraco merged commit 37b04d2 into master Nov 17, 2024
45 of 47 checks passed
@bdraco bdraco deleted the joinpath_perf branch November 17, 2024 16:05
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