Open
Conversation
Contributor
Author
|
@swift-ci please test |
Contributor
Author
|
@swift-ci please test |
jmschonfeld
approved these changes
Mar 30, 2026
88ee31c to
1a0bb3c
Compare
Contributor
Author
|
Squashed and rebased to pick up bug fixes for cross-repo testing |
Contributor
Author
|
@swift-ci please test |
1a0bb3c to
7b38ef5
Compare
Contributor
Author
|
@swift-ci please test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables the faster
Span-basedURLimplementation from #1844 by removing theFOUNDATION_SWIFT_URL_V2build guard. See more implementation details in #1844Motivation:
Many common URL operations such as path manipulation or resolution (currently) involve repeated string allocations, percent-decoding, and re-parsing. By working directly with
Span(s) of the underlying bytes and replacing just the encoded path during path manipulation (ensuring that nearby ranges and path-related flags are updated correctly), we see 5-8x speedup in use cases like appending or deleting path components.The new backing type also consolidates and shares code from the Swift
NSURL/CFURLimplementation, which improves parsing, validation, encoding, and resolution performance (2-3x speedup), and makes it easier to maintain consistent behavior across all the types.Modifications:
Remove
FOUNDATION_SWIFT_URL_V2guard so that the_URLbacking class is used.Result:
Ubuntu 24.04 URL Performance vs. Baseline
URLoperations are significantly faster, andURL,NSURL, andCFURLshare the same Swift code for parsing, percent-encoding, file path initialization, and resolution.Bug fixes/compatibility behaviors:
URLComponentsencoding to match originalCFURLbyte encoding behavior and the behavior of most other RFC 3986 and WHATWG parsers). Resolves Double encoding of query component #1190.[and]unencoded in the path, query, and fragment via Allow square brackets in Swift CFURL path, query, and fragment #1802, matching WHATWG behavior.standardizednow preserves leading..segments in relative paths so they're not removed until resolution.%43:is not mistaken for a scheme).appendingPathExtensionrejects extensions containing invalid characters that would be problematic when decoded (e.g. spaces or Unicode directional override characters) instead of storing them percent-encoded.Testing: