Skip to content

Benchmarks for URL and URLComponents #907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2024
Merged

Conversation

jrflat
Copy link
Contributor

@jrflat jrflat commented Sep 9, 2024

Initial performance benchmarks for URL and URLComponents. Results look great, particularly between Swift 5.10 and 6.0 toolchains (old swift-corelibs-foundation vs new swift-foundation implementations). 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!) and URL-ParseInvalid (94x!), as well as a whopping 254x speedup for URLComponents-GetComponentRanges (which is probably due to an implementation difference since we now store the Swift Range<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.

URLBenchmarks Ubuntu 22 04 Swift 5 10 vs 6 0

@jrflat jrflat requested a review from parkera September 9, 2024 16:22
@jrflat
Copy link
Contributor Author

jrflat commented Sep 9, 2024

@swift-ci please test

@jrflat jrflat merged commit e5cff55 into swiftlang:main Sep 17, 2024
3 checks passed
cthielen pushed a commit to cthielen/swift-foundation that referenced this pull request Nov 8, 2024
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