Skip to content

Commit a408803

Browse files
author
Joe Shajrawi
authored
Revert "[stdlib] Add Substring comparison benchmarks"
1 parent 26eceee commit a408803

File tree

2 files changed

+0
-166
lines changed

2 files changed

+0
-166
lines changed

benchmark/single-source/Substring.swift

Lines changed: 0 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -59,155 +59,3 @@ public func run_StringFromLongWholeSubstringGeneric(_ N: Int) {
5959
}
6060
}
6161

62-
private func equivalentWithDistinctBuffers() -> (String, Substring) {
63-
var s0 = longWide
64-
withUnsafeMutablePointer(to: &s0) { blackHole($0) }
65-
s0 += "!"
66-
67-
// These two should be equal but with distinct buffers, both refcounted.
68-
let a = Substring(s0).dropFirst()
69-
let b = String(a)
70-
return (b, a)
71-
}
72-
73-
@inline(never)
74-
public func run_EqualStringSubstring(_ N: Int) {
75-
let (a, b) = equivalentWithDistinctBuffers()
76-
for _ in 1...N*500 {
77-
blackHole(a == b)
78-
}
79-
}
80-
81-
@inline(never)
82-
public func run_EqualSubstringString(_ N: Int) {
83-
let (a, b) = equivalentWithDistinctBuffers()
84-
for _ in 1...N*500 {
85-
blackHole(b == a)
86-
}
87-
}
88-
89-
@inline(never)
90-
public func run_EqualSubstringSubstring(_ N: Int) {
91-
let (_, a) = equivalentWithDistinctBuffers()
92-
let (_, b) = equivalentWithDistinctBuffers()
93-
for _ in 1...N*500 {
94-
blackHole(a == b)
95-
}
96-
}
97-
98-
@inline(never)
99-
public func run_EqualSubstringSubstringGenericEquatable(_ N: Int) {
100-
let (_, a) = equivalentWithDistinctBuffers()
101-
let (_, b) = equivalentWithDistinctBuffers()
102-
func check<T>(_ x: T, _ y: T) where T : Equatable {
103-
blackHole(x == y)
104-
}
105-
for _ in 1...N*500 {
106-
check(a, b)
107-
}
108-
}
109-
110-
/*
111-
func checkEqual<T, U>(_ x: T, _ y: U)
112-
where T : StringProtocol, U : StringProtocol {
113-
blackHole(x == y)
114-
}
115-
116-
@inline(never)
117-
public func run_EqualStringSubstringGenericStringProtocol(_ N: Int) {
118-
let (a, b) = equivalentWithDistinctBuffers()
119-
for _ in 1...N*500 {
120-
checkEqual(a, b)
121-
}
122-
}
123-
124-
@inline(never)
125-
public func run_EqualSubstringStringGenericStringProtocol(_ N: Int) {
126-
let (a, b) = equivalentWithDistinctBuffers()
127-
for _ in 1...N*500 {
128-
checkEqual(b, a)
129-
}
130-
}
131-
132-
@inline(never)
133-
public func run_EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
134-
let (_, a) = equivalentWithDistinctBuffers()
135-
let (_, b) = equivalentWithDistinctBuffers()
136-
for _ in 1...N*500 {
137-
checkEqual(a, b)
138-
}
139-
}
140-
*/
141-
142-
//===----------------------------------------------------------------------===//
143-
144-
/*
145-
@inline(never)
146-
public func run_LessStringSubstring(_ N: Int) {
147-
let (a, b) = equivalentWithDistinctBuffers()
148-
for _ in 1...N*500 {
149-
blackHole(a < b)
150-
}
151-
}
152-
153-
@inline(never)
154-
public func run_LessSubstringString(_ N: Int) {
155-
let (a, b) = equivalentWithDistinctBuffers()
156-
for _ in 1...N*500 {
157-
blackHole(b < a)
158-
}
159-
}
160-
*/
161-
162-
@inline(never)
163-
public func run_LessSubstringSubstring(_ N: Int) {
164-
let (_, a) = equivalentWithDistinctBuffers()
165-
let (_, b) = equivalentWithDistinctBuffers()
166-
for _ in 1...N*500 {
167-
blackHole(a < b)
168-
}
169-
}
170-
171-
@inline(never)
172-
public func run_LessSubstringSubstringGenericComparable(_ N: Int) {
173-
let (_, a) = equivalentWithDistinctBuffers()
174-
let (_, b) = equivalentWithDistinctBuffers()
175-
func check<T>(_ x: T, _ y: T) where T : Comparable {
176-
blackHole(x < y)
177-
}
178-
for _ in 1...N*500 {
179-
check(a, b)
180-
}
181-
}
182-
183-
/*
184-
func checkLess<T, U>(_ x: T, _ y: U)
185-
where T : StringProtocol, U : StringProtocol {
186-
blackHole(x < y)
187-
}
188-
189-
@inline(never)
190-
public func run_LessStringSubstringGenericStringProtocol(_ N: Int) {
191-
let (a, b) = equivalentWithDistinctBuffers()
192-
for _ in 1...N*500 {
193-
checkLess(a, b)
194-
}
195-
}
196-
197-
@inline(never)
198-
public func run_LessSubstringStringGenericStringProtocol(_ N: Int) {
199-
let (a, b) = equivalentWithDistinctBuffers()
200-
for _ in 1...N*500 {
201-
checkLess(b, a)
202-
}
203-
}
204-
205-
@inline(never)
206-
public func run_LessSubstringSubstringGenericStringProtocol(_ N: Int) {
207-
let (_, a) = equivalentWithDistinctBuffers()
208-
let (_, b) = equivalentWithDistinctBuffers()
209-
for _ in 1...N*500 {
210-
checkLess(a, b)
211-
}
212-
}
213-
*/

benchmark/utils/main.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,6 @@ addTo(&precommitTests, "DropWhileCountableRange", run_DropWhileCountableRange)
229229
addTo(&precommitTests, "DropWhileCountableRangeLazy", run_DropWhileCountableRangeLazy)
230230
addTo(&precommitTests, "DropWhileSequence", run_DropWhileSequence)
231231
addTo(&precommitTests, "DropWhileSequenceLazy", run_DropWhileSequenceLazy)
232-
addTo(&precommitTests, "EqualStringSubstring", run_EqualStringSubstring)
233-
addTo(&precommitTests, "EqualStringSubstringGenericStringProtocol", run_EqualStringSubstringGenericStringProtocol)
234-
addTo(&precommitTests, "EqualSubstringString", run_EqualSubstringString)
235-
addTo(&precommitTests, "EqualSubstringStringGenericStringProtocol", run_EqualSubstringStringGenericStringProtocol)
236-
addTo(&precommitTests, "EqualSubstringSubstring", run_EqualSubstringSubstring)
237-
addTo(&precommitTests, "EqualSubstringSubstringGenericEquatable", run_EqualSubstringSubstringGenericEquatable)
238-
addTo(&precommitTests, "EqualSubstringSubstringGenericStringProtocol", run_EqualSubstringSubstringGenericStringProtocol)
239232
addTo(&precommitTests, "ErrorHandling", run_ErrorHandling)
240233
addTo(&precommitTests, "GlobalClass", run_GlobalClass)
241234
addTo(&precommitTests, "Hanoi", run_Hanoi)
@@ -246,13 +239,6 @@ addTo(&precommitTests, "IterateData", run_IterateData)
246239
addTo(&precommitTests, "Join", run_Join)
247240
addTo(&precommitTests, "LazilyFilteredArrays", run_LazilyFilteredArrays)
248241
addTo(&precommitTests, "LazilyFilteredRange", run_LazilyFilteredRange)
249-
addTo(&precommitTests, "LessStringSubstring", run_LessStringSubstring)
250-
addTo(&precommitTests, "LessStringSubstringGenericStringProtocol", run_LessStringSubstringGenericStringProtocol)
251-
addTo(&precommitTests, "LessSubstringString", run_LessSubstringString)
252-
addTo(&precommitTests, "LessSubstringStringGenericStringProtocol", run_LessSubstringStringGenericStringProtocol)
253-
addTo(&precommitTests, "LessSubstringSubstring", run_LessSubstringSubstring)
254-
addTo(&precommitTests, "LessSubstringSubstringGenericComparable", run_LessSubstringSubstringGenericComparable)
255-
addTo(&precommitTests, "LessSubstringSubstringGenericStringProtocol", run_LessSubstringSubstringGenericStringProtocol)
256242
addTo(&precommitTests, "LinkedList", run_LinkedList)
257243
addTo(&precommitTests, "MapReduce", run_MapReduce)
258244
addTo(&precommitTests, "MapReduceAnyCollection", run_MapReduceAnyCollection)

0 commit comments

Comments
 (0)