Skip to content

Benchmarks: bump to swift-tools-version 6.1, support disabling jemalloc, fix Swift 6 concurrency#1958

Merged
itingliu merged 2 commits into
swiftlang:release/6.4.xfrom
itingliu:benchmark-readme
May 12, 2026
Merged

Benchmarks: bump to swift-tools-version 6.1, support disabling jemalloc, fix Swift 6 concurrency#1958
itingliu merged 2 commits into
swiftlang:release/6.4.xfrom
itingliu:benchmark-readme

Conversation

@itingliu

@itingliu itingliu commented May 8, 2026

Copy link
Copy Markdown
Contributor

Motivation

BENCHMARK_DISABLE_JEMALLOC=1 swift package benchmark doesn't actually disable jemalloc when using swift 6+ toolchain

Fix

  • Bump Benchmarks/Package.swift to swift-tools-version 6.1 (required for SwiftPM traits API)
  • Add BENCHMARK_DISABLE_JEMALLOC env var support: when set, package-benchmark is fetched with
    traits: [] to disable the default jemalloc trait, enabling builds in environments where
    jemalloc is unavailable.
  • Fix JSONBenchmarks resource bundle: change .copy("Resources") to .process("Resources") so
    JSON test files land at Contents/Resources/ rather than Contents/Resources/Resources/
  • Fix Swift 6 strict concurrency in all 15 benchmark targets: annotate let benchmarks closures
    as @Sendable () -> Void
  • Fix BenchmarkTimeZone.swift: replace NSTimeZone.knownTimeZoneNames with TimeZone.knownTimeZoneIdentifiers
  • Fix BenchmarkAttributedString.swift: annotate TestAttribute.name with nonisolated(unsafe)
    (the mutation is intentional single-threaded benchmark setup creating 100k distinct entries)
  • Document jemalloc install steps and BENCHMARK_DISABLE_JEMALLOC usage in Foundation_Build_Process.md

@itingliu itingliu requested a review from a team as a code owner May 8, 2026 06:51
@itingliu

itingliu commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

1 similar comment
@itingliu

itingliu commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

Comment thread Benchmarks/Package.swift Outdated
@@ -1,12 +1,12 @@
// swift-tools-version: 5.9
// swift-tools-version: 6.1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The main package manifest is already at swift tools version 6.2, so if you want you could update it to 6.2 to be the same here

Comment thread Benchmarks/Package.swift
dependencies: targetDependency,
path: "Benchmarks/JSON",
resources: [.copy("Resources")],
resources: [.process("Resources")],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We might want to make the same change to the main package swift for test resources

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changing this in the main package caused some JSON test failures, so I'll leave it unchanged for now.

@hassila

hassila commented May 8, 2026

Copy link
Copy Markdown
Contributor

FYI hope to soon have ordo-one/benchmark#333 to better sort the jemalloc thing.

@itingliu

Copy link
Copy Markdown
Contributor Author

FYI hope to soon have ordo-one/package-benchmark#333 to better sort the jemalloc thing.

COOL!

@itingliu

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

1 similar comment
@itingliu

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

itingliu added 2 commits May 13, 2026 07:26
…oc, fix Swift 6 concurrency

- Bump Benchmarks/Package.swift to swift-tools-version 6.1 (required for SwiftPM traits API)
- Add BENCHMARK_DISABLE_JEMALLOC env var support: when set, package-benchmark is fetched with
  traits: [] to disable the default jemalloc trait, enabling builds in environments where
  jemalloc is unavailable.
- Fix JSONBenchmarks resource bundle: change .copy("Resources") to .process("Resources") so
  JSON test files land at Contents/Resources/ rather than Contents/Resources/Resources/
- Fix Swift 6 strict concurrency in all 15 benchmark targets: annotate `let benchmarks` closures
  as `@Sendable () -> Void`
- Fix BenchmarkTimeZone.swift: replace NSTimeZone.knownTimeZoneNames with TimeZone.knownTimeZoneIdentifiers
- Fix BenchmarkAttributedString.swift: annotate TestAttribute.name with nonisolated(unsafe)
  (the mutation is intentional single-threaded benchmark setup creating 100k distinct entries)
- Document jemalloc install steps and BENCHMARK_DISABLE_JEMALLOC usage in Foundation_Build_Process.md
@itingliu itingliu force-pushed the benchmark-readme branch from 28bd23e to edb98b4 Compare May 12, 2026 23:26
@itingliu itingliu changed the base branch from main to release/6.4.x May 12, 2026 23:27
@itingliu

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@itingliu itingliu merged commit fefd257 into swiftlang:release/6.4.x May 12, 2026
24 checks passed
@itingliu itingliu deleted the benchmark-readme branch May 12, 2026 23:50
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