Skip to content

Add JSON benchmarks and make benchmark package build for more targets #810

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 2 commits into from
Aug 6, 2024

Conversation

parkera
Copy link
Contributor

@parkera parkera commented Aug 2, 2024

Adds some JSON benchmarks to the suite, and also makes the benchmarks build for these configs:

Linux, Swift 5.10 (toolchain)
Linux, Swift 6.0 (toolchain)
Linux, Swift 6.0 (package, or local checkout)
macOS (system Foundation.framework)
macOS (package, or local checkout)

@parkera parkera requested review from glessard and jmschonfeld August 2, 2024 00:13
@parkera
Copy link
Contributor Author

parkera commented Aug 2, 2024

@swift-ci test


case .useGitHubPackage:
#if os(macOS)
packageDependency.append(.package(url: "https://github.com/apple/swift-foundation", revision: "8a44479120e4ae0ac8cdbf801943daa0d1e874ad"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have this depend on the main branch rather than a particular hash?

@@ -67,6 +67,8 @@ func registerPredicateTests_disabled() {
#endif

func registerPredicateTests() {
// Temporarily disabled due to link issue
#if FOUNDATION_FRAMEWORK
Copy link
Contributor

@jmschonfeld jmschonfeld Aug 2, 2024

Choose a reason for hiding this comment

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

Should this be #if USE_PACKAGE || os(macOS) (the link issue was only present in non-Darwin toolchains).

FWIW, the link issue should now be resolved, but the macro doesn't exist in a Windows toolchain yet so eventually this will have to be #if USE_PACKAGE || !os(Windows)

let twitter = try! _JSONDecoder().decode(TwitterArchive.self, from: twitterData)

Benchmark("Canada-decodeFromJSON") { benchmark in
let result = try! _JSONDecoder().decode(FeatureCollection.self, from: canadaData)
Copy link
Contributor

Choose a reason for hiding this comment

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

The closure passed to the Benchmark initializer can throw, so we can just use try here. (The benchmarks closure however cannot throw, sadly.)

@parkera
Copy link
Contributor Author

parkera commented Aug 2, 2024

@swift-ci test

@glessard glessard merged commit bfe5638 into swiftlang:main Aug 6, 2024
3 checks passed
cthielen pushed a commit to cthielen/swift-foundation that referenced this pull request Nov 8, 2024
…swiftlang#810)

* Add JSON benchmarks and make benchmark package build for more targets

* Address review feedback
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.

3 participants