Skip to content

Find the URL delimiters with str.find() in _urlsplit(). - #351

Merged
AdrianAtZyte merged 1 commit into
masterfrom
urlsplit-long-speedup
Sep 27, 2026
Merged

AdrianAtZyte merged 1 commit into
masterfrom
urlsplit-long-speedup

Conversation

@wRAR

@wRAR wRAR commented Sep 27, 2026

Copy link
Copy Markdown
Member

No description provided.

@codspeed

codspeed Bot commented Sep 27, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 62.04%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 13 improved benchmarks
✅ 52 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_benchmark_url_long_cold[url_query_parameter] 3,811.4 µs 869.5 µs ×4.4
⚡ test_benchmark_url_long_cold[safe_url_string] 3,831.2 µs 890.5 µs ×4.3
⚡ test_benchmark_url_long_cold[canonicalize_url] 5.9 ms 3 ms +98.69%
⚡ test_benchmark_url_cold[safe_url_string] 4.7 ms 3.4 ms +39.85%
⚡ test_benchmark_url_cold[add_or_replace_parameter] 1.8 ms 1.3 ms +38.23%
⚡ test_benchmark_url_cold[safe_download_url] 993.2 µs 724 µs +37.17%
⚡ test_benchmark_url_cold[parse_data_uri] 1.5 ms 1.1 ms +35.56%
⚡ test_benchmark_url_cold[parse_url] 346.4 µs 257.2 µs +34.64%
⚡ test_benchmark_url_cold[file_uri_to_path] 313.4 µs 242.1 µs +29.43%
⚡ test_benchmark_url_cold[url_query_parameter] 290.8 µs 230.1 µs +26.39%
⚡ test_benchmark_url_cold[any_to_uri] 418.7 µs 335.5 µs +24.79%
⚡ test_benchmark_url_cold[canonicalize_url] 835.4 µs 691.7 µs +20.77%
⚡ test_benchmark_url_cold[add_or_replace_parameters] 764.1 µs 643.3 µs +18.78%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing urlsplit-long-speedup (3deff50) with master (9c1d9cb)

Open in CodSpeed

@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9c1d9cb) to head (3deff50).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #351   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         1052      1043    -9     
  Branches       238       231    -7     
=========================================
- Hits          1052      1043    -9     
Files with missing lines Coverage Δ
w3lib/_url.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AdrianAtZyte AdrianAtZyte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@AdrianAtZyte
AdrianAtZyte merged commit 4d7db49 into master Sep 27, 2026
29 checks passed
@wRAR
wRAR deleted the urlsplit-long-speedup branch September 27, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants