Skip to content
This repository was archived by the owner on Apr 11, 2026. It is now read-only.

optimizations in URL implementation - #1833

Merged
davidhewitt merged 2 commits into
mainfrom
dh/url-efficiency
Nov 4, 2025
Merged

davidhewitt merged 2 commits into
mainfrom
dh/url-efficiency

Conversation

@davidhewitt

Copy link
Copy Markdown
Collaborator

Change Summary

Generally reduces use of needless .to_string() calls around the URL code, to avoid temporary strings. Done as a follow up to #1829

Related issue number

N/A

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@davidhewitt
davidhewitt requested a review from Viicos October 11, 2025 21:18
@codspeed

codspeed Bot commented Oct 11, 2025 •

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #1833 will not alter performance

Comparing dh/url-efficiency (8ebdd8f) with main (4d23017)

Summary

✅ 163 untouched

Comment thread src/url.rs Outdated
} else {
Cow::Owned(encoded)
}
fn encode_userinfo_component(value: &str) -> impl fmt::Display + use<'_> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like the use<..> syntax is only available in Rust 2024.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep we need MSRV 1.82.

There is debate in PyO3 to increase MSRV to 1.83 PyO3/pyo3#5486, so let's just wait on this until 2.13 perhaps.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In #1882 I wrote this without the use<> syntax, so will just update this PR to not have this bit.

@davidhewitt

Copy link
Copy Markdown
Collaborator Author

I tidied this up, just going to merge it as trivial.

@davidhewitt
davidhewitt enabled auto-merge (squash) November 4, 2025 10:51
@davidhewitt
davidhewitt merged commit 65d7c44 into main Nov 4, 2025
31 checks passed
@davidhewitt
davidhewitt deleted the dh/url-efficiency branch November 4, 2025 10:57
davidhewitt added a commit to pydantic/pydantic that referenced this pull request Nov 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants