add benchmark of set isStrictSubset (#23690)

* add benchmark of set isStrictSubset

* fix SetIsStrictSubsetBox

* bug fixes

* change benchmark names to follow naming convention

* fix benchmark names
This commit is contained in:
Keita Nonaka
2019-04-16 23:34:28 -04:00
committed by Karoy Lorentey
parent 844d4df31a
commit 09da304a71

View File

@@ -98,6 +98,47 @@ public let SetTests = [
tags: [.validation, .api, .Set],
setUpFunction: { blackHole([setP, setQ]) }),
BenchmarkInfo(
name: "Set.isStrictSubset.Empty.Int",
runFunction: { n in run_SetIsStrictSubsetInt(setE, setAB, true, 5000 * n) },
tags: [.validation, .api, .Set],
setUpFunction: { blackHole([setE, setAB]) }),
BenchmarkInfo(
name: "Set.isStrictSubset.Int.Empty",
runFunction: { n in run_SetIsStrictSubsetInt(setAB, setE, false, 5000 * n) },
tags: [.validation, .api, .Set],
setUpFunction: { blackHole([setAB, setE]) }),
BenchmarkInfo(
name: "Set.isStrictSubset.Int0",
runFunction: { n in run_SetIsStrictSubsetInt(setAB, setCD, false, 5000 * n) },
tags: [.validation, .api, .Set],
setUpFunction: { blackHole([setAB, setCD]) }),
BenchmarkInfo(
name: "Set.isStrictSubset.Box0",
runFunction: { n in run_SetIsStrictSubsetBox(setOAB, setOCD, false, 5000 * n) },
tags: [.validation, .api, .Set],
setUpFunction: { blackHole([setOAB, setOCD]) }),
BenchmarkInfo(
name: "Set.isStrictSubset.Int25",
runFunction: { n in run_SetIsStrictSubsetInt(setB, setAB, true, 50 * n) },
tags: [.validation, .api, .Set],
setUpFunction: { blackHole([setB, setAB]) }),
BenchmarkInfo(
name: "Set.isStrictSubset.Box25",
runFunction: { n in run_SetIsStrictSubsetBox(setOB, setOAB, true, 50 * n) },
tags: [.validation, .api, .Set],
setUpFunction: { blackHole([setOB, setOAB]) }),
BenchmarkInfo(
name: "Set.isStrictSubset.Int50",
runFunction: { n in run_SetIsStrictSubsetInt(setY, setXY, true, 50 * n) },
tags: [.validation, .api, .Set],
setUpFunction: { blackHole([setY, setXY]) }),
BenchmarkInfo(
name: "Set.isStrictSubset.Int100",
runFunction: { n in run_SetIsStrictSubsetInt(setP, setQ, false, 50 * n) },
tags: [.validation, .api, .Set],
setUpFunction: { blackHole([setP, setQ]) }),
BenchmarkInfo(
name: "Set.isDisjoint.Empty.Int",
runFunction: { n in run_SetIsDisjointInt(setE, setAB, true, 5000 * n) },
@@ -333,6 +374,18 @@ public func run_SetIsSubsetInt(
}
}
@inline(never)
public func run_SetIsStrictSubsetInt(
_ a: Set<Int>,
_ b: Set<Int>,
_ r: Bool,
_ n: Int) {
for _ in 0 ..< n {
let isStrictSubset = a.isStrictSubset(of: identity(b))
CheckResults(isStrictSubset == r)
}
}
@inline(never)
public func run_SetSymmetricDifferenceInt(
_ a: Set<Int>,
@@ -421,6 +474,18 @@ func run_SetIsSubsetBox(
}
}
@inline(never)
func run_SetIsStrictSubsetBox(
_ a: Set<Box<Int>>,
_ b: Set<Box<Int>>,
_ r: Bool,
_ n: Int) {
for _ in 0 ..< n {
let isStrictSubset = a.isStrictSubset(of: identity(b))
CheckResults(isStrictSubset == r)
}
}
@inline(never)
func run_SetSymmetricDifferenceBox(
_ a: Set<Box<Int>>,