Skip to content

Revert "[stdlib] Add Substring comparison benchmarks" #9922

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
merged 1 commit into from
May 25, 2017
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
152 changes: 0 additions & 152 deletions benchmark/single-source/Substring.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,155 +59,3 @@ public func run_StringFromLongWholeSubstringGeneric(_ N: Int) {
}
}

private func equivalentWithDistinctBuffers() -> (String, Substring) {
var s0 = longWide
withUnsafeMutablePointer(to: &s0) { blackHole($0) }
s0 += "!"

// These two should be equal but with distinct buffers, both refcounted.
let a = Substring(s0).dropFirst()
let b = String(a)
return (b, a)
}

@inline(never)
public func run_EqualStringSubstring(_ N: Int) {
let (a, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
blackHole(a == b)
}
}

@inline(never)
public func run_EqualSubstringString(_ N: Int) {
let (a, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
blackHole(b == a)
}
}

@inline(never)
public func run_EqualSubstringSubstring(_ N: Int) {
let (_, a) = equivalentWithDistinctBuffers()
let (_, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
blackHole(a == b)
}
}

@inline(never)
public func run_EqualSubstringSubstringGenericEquatable(_ N: Int) {
let (_, a) = equivalentWithDistinctBuffers()
let (_, b) = equivalentWithDistinctBuffers()
func check<T>(_ x: T, _ y: T) where T : Equatable {
blackHole(x == y)
}
for _ in 1...N*500 {
check(a, b)
}
}

/*
func checkEqual<T, U>(_ x: T, _ y: U)
where T : StringProtocol, U : StringProtocol {
blackHole(x == y)
}

@inline(never)
public func run_EqualStringSubstringGenericStringProtocol(_ N: Int) {
let (a, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
checkEqual(a, b)
}
}

@inline(never)
public func run_EqualSubstringStringGenericStringProtocol(_ N: Int) {
let (a, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
checkEqual(b, a)
}
}

@inline(never)
public func run_EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
let (_, a) = equivalentWithDistinctBuffers()
let (_, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
checkEqual(a, b)
}
}
*/

//===----------------------------------------------------------------------===//

/*
@inline(never)
public func run_LessStringSubstring(_ N: Int) {
let (a, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
blackHole(a < b)
}
}

@inline(never)
public func run_LessSubstringString(_ N: Int) {
let (a, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
blackHole(b < a)
}
}
*/

@inline(never)
public func run_LessSubstringSubstring(_ N: Int) {
let (_, a) = equivalentWithDistinctBuffers()
let (_, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
blackHole(a < b)
}
}

@inline(never)
public func run_LessSubstringSubstringGenericComparable(_ N: Int) {
let (_, a) = equivalentWithDistinctBuffers()
let (_, b) = equivalentWithDistinctBuffers()
func check<T>(_ x: T, _ y: T) where T : Comparable {
blackHole(x < y)
}
for _ in 1...N*500 {
check(a, b)
}
}

/*
func checkLess<T, U>(_ x: T, _ y: U)
where T : StringProtocol, U : StringProtocol {
blackHole(x < y)
}

@inline(never)
public func run_LessStringSubstringGenericStringProtocol(_ N: Int) {
let (a, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
checkLess(a, b)
}
}

@inline(never)
public func run_LessSubstringStringGenericStringProtocol(_ N: Int) {
let (a, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
checkLess(b, a)
}
}

@inline(never)
public func run_LessSubstringSubstringGenericStringProtocol(_ N: Int) {
let (_, a) = equivalentWithDistinctBuffers()
let (_, b) = equivalentWithDistinctBuffers()
for _ in 1...N*500 {
checkLess(a, b)
}
}
*/
14 changes: 0 additions & 14 deletions benchmark/utils/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,6 @@ addTo(&precommitTests, "DropWhileCountableRange", run_DropWhileCountableRange)
addTo(&precommitTests, "DropWhileCountableRangeLazy", run_DropWhileCountableRangeLazy)
addTo(&precommitTests, "DropWhileSequence", run_DropWhileSequence)
addTo(&precommitTests, "DropWhileSequenceLazy", run_DropWhileSequenceLazy)
addTo(&precommitTests, "EqualStringSubstring", run_EqualStringSubstring)
addTo(&precommitTests, "EqualStringSubstringGenericStringProtocol", run_EqualStringSubstringGenericStringProtocol)
addTo(&precommitTests, "EqualSubstringString", run_EqualSubstringString)
addTo(&precommitTests, "EqualSubstringStringGenericStringProtocol", run_EqualSubstringStringGenericStringProtocol)
addTo(&precommitTests, "EqualSubstringSubstring", run_EqualSubstringSubstring)
addTo(&precommitTests, "EqualSubstringSubstringGenericEquatable", run_EqualSubstringSubstringGenericEquatable)
addTo(&precommitTests, "EqualSubstringSubstringGenericStringProtocol", run_EqualSubstringSubstringGenericStringProtocol)
addTo(&precommitTests, "ErrorHandling", run_ErrorHandling)
addTo(&precommitTests, "GlobalClass", run_GlobalClass)
addTo(&precommitTests, "Hanoi", run_Hanoi)
Expand All @@ -246,13 +239,6 @@ addTo(&precommitTests, "IterateData", run_IterateData)
addTo(&precommitTests, "Join", run_Join)
addTo(&precommitTests, "LazilyFilteredArrays", run_LazilyFilteredArrays)
addTo(&precommitTests, "LazilyFilteredRange", run_LazilyFilteredRange)
addTo(&precommitTests, "LessStringSubstring", run_LessStringSubstring)
addTo(&precommitTests, "LessStringSubstringGenericStringProtocol", run_LessStringSubstringGenericStringProtocol)
addTo(&precommitTests, "LessSubstringString", run_LessSubstringString)
addTo(&precommitTests, "LessSubstringStringGenericStringProtocol", run_LessSubstringStringGenericStringProtocol)
addTo(&precommitTests, "LessSubstringSubstring", run_LessSubstringSubstring)
addTo(&precommitTests, "LessSubstringSubstringGenericComparable", run_LessSubstringSubstringGenericComparable)
addTo(&precommitTests, "LessSubstringSubstringGenericStringProtocol", run_LessSubstringSubstringGenericStringProtocol)
addTo(&precommitTests, "LinkedList", run_LinkedList)
addTo(&precommitTests, "MapReduce", run_MapReduce)
addTo(&precommitTests, "MapReduceAnyCollection", run_MapReduceAnyCollection)
Expand Down