-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Even more type checker perf tests #84890
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
slavapestov
merged 2 commits into
swiftlang:main
from
slavapestov:even-more-type-checker-perf-tests
Oct 15, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
validation-test/Sema/type_checker_perf/fast/issue-43715.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // RUN: %target-typecheck-verify-swift -solver-scope-threshold=300 | ||
|
|
||
| func slow(someOptionalString: String?) { | ||
| print("\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")\(someOptionalString ?? "")") | ||
| } | ||
20 changes: 20 additions & 0 deletions
20
validation-test/Sema/type_checker_perf/fast/issue-43943.swift.gyb
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // RUN: %scale-test --begin 1 --end 6 --step 1 --select NumLeafScopes %s | ||
| // REQUIRES: asserts,no_asan | ||
|
|
||
| extension String { | ||
| func replacingOccurrences(of: String, with: String) -> String { | ||
| return "" | ||
| } | ||
| } | ||
|
|
||
| func slow(something: String?) { | ||
| var str = "" | ||
|
|
||
| [ | ||
| %for i in range(0, N): | ||
| ("${i}", something ?? ""), | ||
| %end | ||
| ].forEach { | ||
| str = str.replacingOccurrences(of: $0, with: $1) | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
validation-test/Sema/type_checker_perf/fast/issue-44181.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // RUN: %target-typecheck-verify-swift -solver-scope-threshold=300 | ||
|
|
||
| enum DebugValue { | ||
| case TupleValue([(name: String?, value: DebugValue)]) | ||
|
|
||
| var stringRepresentation: String { | ||
| switch self { | ||
| case .TupleValue(let values): | ||
| return "(\(values.map { ($0.name.flatMap { "\($0): " } ?? "") + $0.value.stringRepresentation }.joined(separator: ", ")))" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| extension DebugValue : Equatable { } | ||
|
|
||
| func == (lhs: DebugValue, rhs: DebugValue) -> Bool { | ||
| switch (lhs, rhs) { | ||
| case (DebugValue.TupleValue(let xs), DebugValue.TupleValue(let ys)) where xs.count == ys.count: | ||
| return zip(xs, ys).reduce(true) { $0 ? $1.0.name == $1.1.name && $1.0.value == $1.1.value : false } | ||
| default: | ||
| return false | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
validation-test/Sema/type_checker_perf/fast/issue-46430.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // RUN: %target-typecheck-verify-swift -solver-scope-threshold=200 | ||
|
|
||
| func slow(_ m: [[UInt32]]) { | ||
| var n = m | ||
| for i in 1 ..< 10 { | ||
| for j in 1 ..< 10 { | ||
| n[i][j] = min(n[i - 1][j - 1], n[i - 1][j], n[i][j - 1]) + 1 | ||
| } | ||
| } | ||
| } | ||
|
|
10 changes: 10 additions & 0 deletions
10
validation-test/Sema/type_checker_perf/fast/issue-46477.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // RUN: %target-typecheck-verify-swift -solver-scope-threshold=2000 | ||
|
|
||
| func foo(_ string: String) -> Int { | ||
| let bar = Array(string) | ||
| .reversed() | ||
| .enumerated() | ||
| .map { ((1 << ($0 + 1)) % 11) * Int(String($1))! } | ||
| .reduce(0) { $0 + $1 } | ||
| return (12 - bar % 11) % 11 | ||
| } |
27 changes: 27 additions & 0 deletions
27
validation-test/Sema/type_checker_perf/fast/issue-48418.swift.gyb
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // RUN: %scale-test --begin 1 --end 6 --step 1 --select NumLeafScopes %s | ||
| // REQUIRES: asserts,no_asan | ||
|
|
||
| enum A { | ||
| case a | ||
| } | ||
|
|
||
| enum B { | ||
| case none | ||
|
|
||
| func encode() -> Int { | ||
| return 0 | ||
| } | ||
| } | ||
|
|
||
| extension Int { | ||
| func print() {} | ||
| } | ||
|
|
||
| func encode(settings: Dictionary<A, B>) { | ||
| ( | ||
| %for i in range(0, N): | ||
| (settings[.a] ?? .none).encode() | | ||
| %end | ||
| (settings[.a] ?? .none).encode() | ||
| ).print() | ||
| } |
2 changes: 1 addition & 1 deletion
2
..._checker_perf/slow/rdar23327871.swift.gyb → ..._checker_perf/fast/rdar23327871.swift.gyb
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
11 changes: 11 additions & 0 deletions
11
validation-test/Sema/type_checker_perf/fast/rdar25866240.swift.gyb
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // RUN: not %scale-test --begin 1 --end 5 --step 1 --select incrementScopeCounter %s | ||
| // REQUIRES: OS=macosx | ||
| // REQUIRES: asserts | ||
|
|
||
| func f() { | ||
| % for i in range(N): | ||
| let collection${i} = [String]() | ||
| % end | ||
|
|
||
| _ = ${' + '.join("collection%s" % i for i in range(N))} | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 | ||
| // RUN: %target-typecheck-verify-swift -solver-scope-threshold=200 | ||
| // REQUIRES: tools-release,no_asan | ||
|
|
||
| let _ = 1 | UInt32(0) << 0 | UInt32(1) << 1 | UInt32(2) << 2 | UInt32(3) << 3 | UInt32(4) << 4 |
26 changes: 0 additions & 26 deletions
26
validation-test/Sema/type_checker_perf/slow/rdar25866240.gyb
This file was deleted.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vaguely remember one with a bunch of ?? operators like that in the suite, could you please double-check if we already have it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had a bunch with ?? but this one also has string interpolation. Do you think it’s worth keeping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, sure!