@@ -31,6 +31,8 @@ public let SubstringTest = [
31
31
32
32
// A string that doesn't fit in small string storage and doesn't fit in Latin-1
33
33
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 ( )
34
36
35
37
@inline ( never)
36
38
public func run_SubstringFromLongString( _ N: Int ) {
@@ -89,33 +91,33 @@ private func equivalentWithDistinctBuffers() -> (String, Substring) {
89
91
90
92
@inline ( never)
91
93
public func run_EqualStringSubstring( _ N: Int ) {
92
- let ( a, b) = equivalentWithDistinctBuffers ( )
94
+ let ( a, b) = ( s1 , ss1 )
93
95
for _ in 1 ... N*500 {
94
96
blackHole ( a == b)
95
97
}
96
98
}
97
99
98
100
@inline ( never)
99
101
public func run_EqualSubstringString( _ N: Int ) {
100
- let ( a, b) = equivalentWithDistinctBuffers ( )
102
+ let ( a, b) = ( s1 , ss1 )
101
103
for _ in 1 ... N*500 {
102
104
blackHole ( b == a)
103
105
}
104
106
}
105
107
106
108
@inline ( never)
107
109
public func run_EqualSubstringSubstring( _ N: Int ) {
108
- let ( _, a) = equivalentWithDistinctBuffers ( )
109
- let ( _, b) = equivalentWithDistinctBuffers ( )
110
+ let ( _, a) = ( s1 , ss1 )
111
+ let ( _, b) = ( s2 , ss2 )
110
112
for _ in 1 ... N*500 {
111
113
blackHole ( a == b)
112
114
}
113
115
}
114
116
115
117
@inline ( never)
116
118
public func run_EqualSubstringSubstringGenericEquatable( _ N: Int ) {
117
- let ( _, a) = equivalentWithDistinctBuffers ( )
118
- let ( _, b) = equivalentWithDistinctBuffers ( )
119
+ let ( _, a) = ( s1 , ss1 )
120
+ let ( _, b) = ( s2 , ss2 )
119
121
func check< T> ( _ x: T , _ y: T ) where T : Equatable {
120
122
blackHole ( x == y)
121
123
}
@@ -132,24 +134,24 @@ where T : StringProtocol, U : StringProtocol {
132
134
133
135
@inline(never)
134
136
public func run _EqualStringSubstringGenericStringProtocol(_ N: Int) {
135
- let (a, b) = equivalentWithDistinctBuffers( )
137
+ let (a, b) = (s1, ss1 )
136
138
for _ in 1...N*500 {
137
139
checkEqual(a, b)
138
140
}
139
141
}
140
142
141
143
@inline(never)
142
144
public func run _EqualSubstringStringGenericStringProtocol(_ N: Int) {
143
- let (a, b) = equivalentWithDistinctBuffers( )
145
+ let (a, b) = (s1, ss1 )
144
146
for _ in 1...N*500 {
145
147
checkEqual(b, a)
146
148
}
147
149
}
148
150
149
151
@inline(never)
150
152
public func run _EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
151
- let (_, a) = equivalentWithDistinctBuffers( )
152
- let (_, b) = equivalentWithDistinctBuffers( )
153
+ let (_, a) = (s1, ss1 )
154
+ let (_, b) = (s2, ss2 )
153
155
for _ in 1...N*500 {
154
156
checkEqual(a, b)
155
157
}
@@ -161,15 +163,15 @@ public func run _EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
161
163
/*
162
164
@inline(never)
163
165
public func run _LessStringSubstring(_ N: Int) {
164
- let (a, b) = equivalentWithDistinctBuffers( )
166
+ let (a, b) = (s1, ss1 )
165
167
for _ in 1...N*500 {
166
168
blackHole(a < b)
167
169
}
168
170
}
169
171
170
172
@inline(never)
171
173
public func run _LessSubstringString(_ N: Int) {
172
- let (a, b) = equivalentWithDistinctBuffers( )
174
+ let (a, b) = (s1, ss1 )
173
175
for _ in 1...N*500 {
174
176
blackHole(b < a)
175
177
}
@@ -178,17 +180,17 @@ public func run _LessSubstringString(_ N: Int) {
178
180
179
181
@inline ( never)
180
182
public func run_LessSubstringSubstring( _ N: Int ) {
181
- let ( _, a) = equivalentWithDistinctBuffers ( )
182
- let ( _, b) = equivalentWithDistinctBuffers ( )
183
+ let ( _, a) = ( s1 , ss1 )
184
+ let ( _, b) = ( s2 , ss2 )
183
185
for _ in 1 ... N*500 {
184
186
blackHole ( a < b)
185
187
}
186
188
}
187
189
188
190
@inline ( never)
189
191
public func run_LessSubstringSubstringGenericComparable( _ N: Int ) {
190
- let ( _, a) = equivalentWithDistinctBuffers ( )
191
- let ( _, b) = equivalentWithDistinctBuffers ( )
192
+ let ( _, a) = ( s1 , ss1 )
193
+ let ( _, b) = ( s2 , ss2 )
192
194
func check< T> ( _ x: T , _ y: T ) where T : Comparable {
193
195
blackHole ( x < y)
194
196
}
@@ -251,24 +253,24 @@ where T : StringProtocol, U : StringProtocol {
251
253
252
254
@inline(never)
253
255
public func run _LessStringSubstringGenericStringProtocol(_ N: Int) {
254
- let (a, b) = equivalentWithDistinctBuffers( )
256
+ let (a, b) = (s1, ss1 )
255
257
for _ in 1...N*500 {
256
258
checkLess(a, b)
257
259
}
258
260
}
259
261
260
262
@inline(never)
261
263
public func run _LessSubstringStringGenericStringProtocol(_ N: Int) {
262
- let (a, b) = equivalentWithDistinctBuffers( )
264
+ let (a, b) = (s1, ss1 )
263
265
for _ in 1...N*500 {
264
266
checkLess(b, a)
265
267
}
266
268
}
267
269
268
270
@inline(never)
269
271
public func run _LessSubstringSubstringGenericStringProtocol(_ N: Int) {
270
- let (_, a) = equivalentWithDistinctBuffers( )
271
- let (_, b) = equivalentWithDistinctBuffers( )
272
+ let (_, a) = (s1, ss1 )
273
+ let (_, b) = (s2, ss2 )
272
274
for _ in 1...N*500 {
273
275
checkLess(a, b)
274
276
}
0 commit comments