14
14
// rdar://problem/19804127
15
15
import TestsUtils
16
16
17
+ let t : [ BenchmarkCategory ] = [ . validation, . api, . Dictionary]
18
+
17
19
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 ) ,
22
28
]
23
29
24
30
@inline ( never)
@@ -33,7 +39,7 @@ public func run_DictionarySwap(_ N: Int) {
33
39
CheckResults ( dict. count == size)
34
40
35
41
var swapped = false
36
- for _ in 1 ... 10000 * N {
42
+ for _ in 1 ... 2500 * N {
37
43
( dict [ 25 ] , dict [ 75 ] ) = ( dict [ 75 ] !, dict [ 25 ] !)
38
44
swapped = !swapped
39
45
if !swappedCorrectly( swapped, dict [ 25 ] !, dict [ 75 ] !) {
@@ -56,7 +62,7 @@ public func run_DictionarySwapAt(_ N: Int) {
56
62
CheckResults ( dict. count == size)
57
63
58
64
var swapped = false
59
- for _ in 1 ... 10000 * N {
65
+ for _ in 1 ... 2500 * N {
60
66
let i25 = dict. index ( forKey: 25 ) !
61
67
let i75 = dict. index ( forKey: 75 ) !
62
68
@@ -104,7 +110,7 @@ public func run_DictionarySwapOfObjects(_ N: Int) {
104
110
CheckResults ( dict. count == size)
105
111
106
112
var swapped = false
107
- for _ in 1 ... 10000 * N {
113
+ for _ in 1 ... 250 * N {
108
114
let b1 = Box ( 25 )
109
115
let b2 = Box ( 75 )
110
116
( dict [ b1] , dict [ b2] ) = ( dict [ b2] !, dict [ b1] !)
@@ -129,7 +135,7 @@ public func run_DictionarySwapAtOfObjects(_ N: Int) {
129
135
CheckResults ( dict. count == size)
130
136
131
137
var swapped = false
132
- for _ in 1 ... 10000 * N {
138
+ for _ in 1 ... 250 * N {
133
139
let b25 = Box ( 25 )
134
140
let b75 = Box ( 75 )
135
141
let i25 = dict. index ( forKey: b25) !
0 commit comments