@@ -25,11 +25,23 @@ let t: [BenchmarkCategory] = [.validation, .api, .Dictionary]
25
25
26
26
public let DictionaryCompactMapValues = [
27
27
BenchmarkInfo ( name: " DictionaryCompactMapValuesOfNilValue " ,
28
- runFunction: { for _ in 1 ... $0 * 20 {
29
- CheckResults ( smallOddNumMap. compactMapValues ( { $0 } ) == compactOddNums) } } ,
30
- tags : t , legacyFactor: 50 ) ,
28
+ runFunction: compactMapValues , tags : t ,
29
+ setUpFunction : { blackHole ( smallOddNumMap) ; blackHole ( compactOddNums) } ,
30
+ legacyFactor: 50 ) ,
31
31
BenchmarkInfo ( name: " DictionaryCompactMapValuesOfCastValue " ,
32
- runFunction: { for _ in 1 ... $0 * 20 {
33
- CheckResults ( oddStringMap. compactMapValues ( Int . init ) == compactOddNums) }
34
- } , tags : t , legacyFactor: 54 ) ,
32
+ runFunction: compactMapValuesInt , tags : t ,
33
+ setUpFunction : { blackHole ( oddStringMap) ; blackHole ( compactOddNums) } ,
34
+ legacyFactor: 54 ) ,
35
35
]
36
+
37
+ func compactMapValues( N: Int ) {
38
+ for _ in 1 ... 20 * N {
39
+ CheckResults ( smallOddNumMap. compactMapValues ( { $0} ) == compactOddNums)
40
+ }
41
+ }
42
+
43
+ func compactMapValuesInt( N: Int ) {
44
+ for _ in 1 ... 20 * N {
45
+ CheckResults ( oddStringMap. compactMapValues ( Int . init) == compactOddNums)
46
+ }
47
+ }
0 commit comments