Skip to content

Commit acb2c18

Browse files
committed
[benchmark] DictionarySwap Legacy Factor
1 parent 85c8bff commit acb2c18

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

benchmark/single-source/DictionarySwap.swift

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@
1414
// rdar://problem/19804127
1515
import TestsUtils
1616

17+
let t: [BenchmarkCategory] = [.validation, .api, .Dictionary]
18+
1719
public let DictionarySwap = [
18-
BenchmarkInfo(name: "DictionarySwap", runFunction: run_DictionarySwap, tags: [.validation, .api, .Dictionary]),
19-
BenchmarkInfo(name: "DictionarySwapOfObjects", runFunction: run_DictionarySwapOfObjects, tags: [.validation, .api, .Dictionary]),
20-
BenchmarkInfo(name: "DictionarySwapAt", runFunction: run_DictionarySwapAt, tags: [.validation, .api, .Dictionary]),
21-
BenchmarkInfo(name: "DictionarySwapAtOfObjects", runFunction: run_DictionarySwapAtOfObjects, tags: [.validation, .api, .Dictionary]),
20+
BenchmarkInfo(name: "DictionarySwap",
21+
runFunction: run_DictionarySwap, tags: t, legacyFactor: 4),
22+
BenchmarkInfo(name: "DictionarySwapOfObjects",
23+
runFunction: run_DictionarySwapOfObjects, tags: t, legacyFactor: 40),
24+
BenchmarkInfo(name: "DictionarySwapAt",
25+
runFunction: run_DictionarySwapAt, tags: t, legacyFactor: 4),
26+
BenchmarkInfo(name: "DictionarySwapAtOfObjects",
27+
runFunction: run_DictionarySwapAtOfObjects, tags: t, legacyFactor: 40),
2228
]
2329

2430
@inline(never)
@@ -33,7 +39,7 @@ public func run_DictionarySwap(_ N: Int) {
3339
CheckResults(dict.count == size)
3440

3541
var swapped = false
36-
for _ in 1...10000*N {
42+
for _ in 1...2500*N {
3743
(dict[25], dict[75]) = (dict[75]!, dict[25]!)
3844
swapped = !swapped
3945
if !swappedCorrectly(swapped, dict[25]!, dict[75]!) {
@@ -56,7 +62,7 @@ public func run_DictionarySwapAt(_ N: Int) {
5662
CheckResults(dict.count == size)
5763

5864
var swapped = false
59-
for _ in 1...10000*N {
65+
for _ in 1...2500*N {
6066
let i25 = dict.index(forKey: 25)!
6167
let i75 = dict.index(forKey: 75)!
6268

@@ -104,7 +110,7 @@ public func run_DictionarySwapOfObjects(_ N: Int) {
104110
CheckResults(dict.count == size)
105111

106112
var swapped = false
107-
for _ in 1...10000*N {
113+
for _ in 1...250*N {
108114
let b1 = Box(25)
109115
let b2 = Box(75)
110116
(dict[b1], dict[b2]) = (dict[b2]!, dict[b1]!)
@@ -129,7 +135,7 @@ public func run_DictionarySwapAtOfObjects(_ N: Int) {
129135
CheckResults(dict.count == size)
130136

131137
var swapped = false
132-
for _ in 1...10000*N {
138+
for _ in 1...250*N {
133139
let b25 = Box(25)
134140
let b75 = Box(75)
135141
let i25 = dict.index(forKey: b25)!

0 commit comments

Comments
 (0)