Skip to content

Commit 1330ab0

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents 3b53f55 + 7d0438b commit 1330ab0

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

benchmark/single-source/ArrayInClass.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ public let ArrayInClass = [
1717
runFunction: run_ArrayInClass,
1818
tags: [.validation, .api, .Array],
1919
setUpFunction: { ac = ArrayContainer() },
20-
tearDownFunction: { ac = nil }),
20+
tearDownFunction: { ac = nil },
21+
legacyFactor: 5),
2122
BenchmarkInfo(name: "DistinctClassFieldAccesses",
2223
runFunction: run_DistinctClassFieldAccesses,
23-
tags: [.unstable, .api, .Array],
24-
setUpFunction: { workload = ClassWithArrs(N: 100_000) },
24+
tags: [.validation, .api, .Array],
25+
setUpFunction: { workload = ClassWithArrs(N: 10_000) },
2526
tearDownFunction: { workload = nil }),
2627
]
2728

@@ -31,7 +32,7 @@ class ArrayContainer {
3132
final var arr : [Int]
3233

3334
init() {
34-
arr = [Int] (repeating: 0, count: 100_000)
35+
arr = [Int] (repeating: 0, count: 20_000)
3536
}
3637

3738
func runLoop(_ N: Int) {

benchmark/single-source/DictionaryOfAnyHashableStrings.swift

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,15 @@ public var DictionaryOfAnyHashableStrings = [
2121
name: "DictionaryOfAnyHashableStrings_insert",
2222
runFunction: run_DictionaryOfAnyHashableStrings_insert,
2323
tags: [.abstraction, .runtime, .cpubench],
24-
setUpFunction: {
25-
keys = buildKeys(500)
26-
}
24+
setUpFunction: { keys = buildKeys(50) },
25+
legacyFactor: 14
2726
),
2827
BenchmarkInfo(
2928
name: "DictionaryOfAnyHashableStrings_lookup",
3029
runFunction: run_DictionaryOfAnyHashableStrings_lookup,
3130
tags: [.abstraction, .runtime, .cpubench],
32-
setUpFunction: {
33-
keys = buildKeys(500)
34-
workload = buildWorkload()
35-
}
31+
setUpFunction: { keys = buildKeys(50); workload = buildWorkload() },
32+
legacyFactor: 24
3633
),
3734
]
3835

@@ -65,7 +62,7 @@ func buildWorkload() -> [AnyHashable: Any] {
6562
@inline(never)
6663
public func run_DictionaryOfAnyHashableStrings_insert(_ n: Int) {
6764
precondition(keys.count > 0)
68-
for _ in 0 ... n {
65+
for _ in 1...n {
6966
blackHole(buildWorkload())
7067
}
7168
}
@@ -74,7 +71,7 @@ public func run_DictionaryOfAnyHashableStrings_insert(_ n: Int) {
7471
public func run_DictionaryOfAnyHashableStrings_lookup(_ n: Int) {
7572
precondition(workload.count > 0)
7673
precondition(keys.count > 0)
77-
for _ in 0 ... n {
74+
for _ in 1...n {
7875
for i in 0 ..< keys.count {
7976
let key = keys[i]
8077
CheckResults((workload[key] as! Int) == i)

benchmark/single-source/Substring.swift

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public let SubstringTest = [
3131

3232
// A string that doesn't fit in small string storage and doesn't fit in Latin-1
3333
let longWide = "fὢasὢodὢijὢadὢolὢsjὢalὢsdὢjlὢasὢdfὢijὢliὢsdὢjøὢslὢdiὢalὢiὢ"
34+
let (s1, ss1) = equivalentWithDistinctBuffers()
35+
let (s2, ss2) = equivalentWithDistinctBuffers()
3436

3537
@inline(never)
3638
public func run_SubstringFromLongString(_ N: Int) {
@@ -89,33 +91,33 @@ private func equivalentWithDistinctBuffers() -> (String, Substring) {
8991

9092
@inline(never)
9193
public func run_EqualStringSubstring(_ N: Int) {
92-
let (a, b) = equivalentWithDistinctBuffers()
94+
let (a, b) = (s1, ss1)
9395
for _ in 1...N*500 {
9496
blackHole(a == b)
9597
}
9698
}
9799

98100
@inline(never)
99101
public func run_EqualSubstringString(_ N: Int) {
100-
let (a, b) = equivalentWithDistinctBuffers()
102+
let (a, b) = (s1, ss1)
101103
for _ in 1...N*500 {
102104
blackHole(b == a)
103105
}
104106
}
105107

106108
@inline(never)
107109
public func run_EqualSubstringSubstring(_ N: Int) {
108-
let (_, a) = equivalentWithDistinctBuffers()
109-
let (_, b) = equivalentWithDistinctBuffers()
110+
let (_, a) = (s1, ss1)
111+
let (_, b) = (s2, ss2)
110112
for _ in 1...N*500 {
111113
blackHole(a == b)
112114
}
113115
}
114116

115117
@inline(never)
116118
public func run_EqualSubstringSubstringGenericEquatable(_ N: Int) {
117-
let (_, a) = equivalentWithDistinctBuffers()
118-
let (_, b) = equivalentWithDistinctBuffers()
119+
let (_, a) = (s1, ss1)
120+
let (_, b) = (s2, ss2)
119121
func check<T>(_ x: T, _ y: T) where T : Equatable {
120122
blackHole(x == y)
121123
}
@@ -132,24 +134,24 @@ where T : StringProtocol, U : StringProtocol {
132134

133135
@inline(never)
134136
public func run _EqualStringSubstringGenericStringProtocol(_ N: Int) {
135-
let (a, b) = equivalentWithDistinctBuffers()
137+
let (a, b) = (s1, ss1)
136138
for _ in 1...N*500 {
137139
checkEqual(a, b)
138140
}
139141
}
140142

141143
@inline(never)
142144
public func run _EqualSubstringStringGenericStringProtocol(_ N: Int) {
143-
let (a, b) = equivalentWithDistinctBuffers()
145+
let (a, b) = (s1, ss1)
144146
for _ in 1...N*500 {
145147
checkEqual(b, a)
146148
}
147149
}
148150

149151
@inline(never)
150152
public func run _EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
151-
let (_, a) = equivalentWithDistinctBuffers()
152-
let (_, b) = equivalentWithDistinctBuffers()
153+
let (_, a) = (s1, ss1)
154+
let (_, b) = (s2, ss2)
153155
for _ in 1...N*500 {
154156
checkEqual(a, b)
155157
}
@@ -161,15 +163,15 @@ public func run _EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
161163
/*
162164
@inline(never)
163165
public func run _LessStringSubstring(_ N: Int) {
164-
let (a, b) = equivalentWithDistinctBuffers()
166+
let (a, b) = (s1, ss1)
165167
for _ in 1...N*500 {
166168
blackHole(a < b)
167169
}
168170
}
169171

170172
@inline(never)
171173
public func run _LessSubstringString(_ N: Int) {
172-
let (a, b) = equivalentWithDistinctBuffers()
174+
let (a, b) = (s1, ss1)
173175
for _ in 1...N*500 {
174176
blackHole(b < a)
175177
}
@@ -178,17 +180,17 @@ public func run _LessSubstringString(_ N: Int) {
178180

179181
@inline(never)
180182
public func run_LessSubstringSubstring(_ N: Int) {
181-
let (_, a) = equivalentWithDistinctBuffers()
182-
let (_, b) = equivalentWithDistinctBuffers()
183+
let (_, a) = (s1, ss1)
184+
let (_, b) = (s2, ss2)
183185
for _ in 1...N*500 {
184186
blackHole(a < b)
185187
}
186188
}
187189

188190
@inline(never)
189191
public func run_LessSubstringSubstringGenericComparable(_ N: Int) {
190-
let (_, a) = equivalentWithDistinctBuffers()
191-
let (_, b) = equivalentWithDistinctBuffers()
192+
let (_, a) = (s1, ss1)
193+
let (_, b) = (s2, ss2)
192194
func check<T>(_ x: T, _ y: T) where T : Comparable {
193195
blackHole(x < y)
194196
}
@@ -251,24 +253,24 @@ where T : StringProtocol, U : StringProtocol {
251253

252254
@inline(never)
253255
public func run _LessStringSubstringGenericStringProtocol(_ N: Int) {
254-
let (a, b) = equivalentWithDistinctBuffers()
256+
let (a, b) = (s1, ss1)
255257
for _ in 1...N*500 {
256258
checkLess(a, b)
257259
}
258260
}
259261

260262
@inline(never)
261263
public func run _LessSubstringStringGenericStringProtocol(_ N: Int) {
262-
let (a, b) = equivalentWithDistinctBuffers()
264+
let (a, b) = (s1, ss1)
263265
for _ in 1...N*500 {
264266
checkLess(b, a)
265267
}
266268
}
267269

268270
@inline(never)
269271
public func run _LessSubstringSubstringGenericStringProtocol(_ N: Int) {
270-
let (_, a) = equivalentWithDistinctBuffers()
271-
let (_, b) = equivalentWithDistinctBuffers()
272+
let (_, a) = (s1, ss1)
273+
let (_, b) = (s2, ss2)
272274
for _ in 1...N*500 {
273275
checkLess(a, b)
274276
}

0 commit comments

Comments
 (0)