Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ?? "")")
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, sure!

}
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 validation-test/Sema/type_checker_perf/fast/issue-44181.swift
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 validation-test/Sema/type_checker_perf/fast/issue-46430.swift
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 validation-test/Sema/type_checker_perf/fast/issue-46477.swift
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
}
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()
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %scale-test --begin 8 --end 16 --step 1 --select NumLeafScopes %s -Xfrontend=-solver-expression-time-threshold=1
// RUN: %scale-test --begin 8 --end 16 --step 1 --select NumLeafScopes %s
// REQUIRES: asserts,no_asan

let i = 1
Expand Down
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))}
}
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 validation-test/Sema/type_checker_perf/slow/rdar25866240.gyb

This file was deleted.