Benchmarks for URL and URLComponents #907
Merged
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.
Initial performance benchmarks for
URLandURLComponents. Results look great, particularly between Swift 5.10 and 6.0 toolchains (oldswift-corelibs-foundationvs newswift-foundationimplementations). I tested on the latest Ubuntu 22.04 Swift 5.10 and nightly-6.0 images. (swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a)From 5.10 to 6.0, we see a 5-10x speedup for almost all benchmarks, with even better outliers for
URL-ParseValidASCII(29x!) andURL-ParseInvalid(94x!), as well as a whopping 254x speedup forURLComponents-GetComponentRanges(which is probably due to an implementation difference since we now store the SwiftRange<String.Index>directly). These results were consistent across many runs.I think the 29x speedup of
URL(string:)for valid URL strings is the most significant improvement because that's the most common use case.