@@ -14,73 +14,67 @@ import TestsUtils
14
14
15
15
public let FlattenDistanceFromTo = [
16
16
BenchmarkInfo (
17
- name: " FlattenDistanceFromTo.RandomAccess.16x16 " ,
18
- runFunction: { with ( randomAccess16x16 , $0) } ,
17
+ name: " FlattenDistanceFromTo.Array.Array.16.16 " ,
18
+ runFunction: { with ( arrayArray16x16 , $0) } ,
19
19
tags: [ . validation, . api] ,
20
- setUpFunction: { blackHole ( randomAccess16x16 ) } ) ,
20
+ setUpFunction: { blackHole ( arrayArray16x16 ) } ) ,
21
21
22
22
BenchmarkInfo (
23
- name: " FlattenDistanceFromTo.RandomAccess.16x32 " ,
24
- runFunction: { with ( randomAccess16x32 , $0) } ,
23
+ name: " FlattenDistanceFromTo.Array.Array.16.32 " ,
24
+ runFunction: { with ( arrayArray16x32 , $0) } ,
25
25
tags: [ . validation, . api] ,
26
- setUpFunction: { blackHole ( randomAccess16x32 ) } ) ,
26
+ setUpFunction: { blackHole ( arrayArray16x32 ) } ) ,
27
27
28
28
BenchmarkInfo (
29
- name: " FlattenDistanceFromTo.RandomAccess.32x16 " ,
30
- runFunction: { with ( randomAccess32x16 , $0) } ,
29
+ name: " FlattenDistanceFromTo.Array.Array.32.16 " ,
30
+ runFunction: { with ( arrayArray32x16 , $0) } ,
31
31
tags: [ . validation, . api] ,
32
- setUpFunction: { blackHole ( randomAccess32x16 ) } ) ,
32
+ setUpFunction: { blackHole ( arrayArray32x16 ) } ) ,
33
33
34
34
BenchmarkInfo (
35
- name: " FlattenDistanceFromTo.RandomAccess.32x32 " ,
36
- runFunction: { with ( randomAccess32x32 , $0) } ,
35
+ name: " FlattenDistanceFromTo.Array.Array.32.32 " ,
36
+ runFunction: { with ( arrayArray32x32 , $0) } ,
37
37
tags: [ . validation, . api] ,
38
- setUpFunction: { blackHole ( randomAccess32x32 ) } ) ,
38
+ setUpFunction: { blackHole ( arrayArray32x32 ) } ) ,
39
39
40
40
BenchmarkInfo (
41
- name: " FlattenDistanceFromTo.RepeatString.08x08 " ,
42
- runFunction: { with ( repeatString08x08 , $0) } ,
41
+ name: " FlattenDistanceFromTo.Array.String.08.08 " ,
42
+ runFunction: { with ( arrayString08x08 , $0) } ,
43
43
tags: [ . validation, . api] ,
44
- setUpFunction: { blackHole ( repeatString08x08 ) } ) ,
44
+ setUpFunction: { blackHole ( arrayString08x08 ) } ) ,
45
45
46
46
BenchmarkInfo (
47
- name: " FlattenDistanceFromTo.RepeatString.08x16 " ,
48
- runFunction: { with ( repeatString08x16 , $0) } ,
47
+ name: " FlattenDistanceFromTo.Array.String.08.16 " ,
48
+ runFunction: { with ( arrayString08x16 , $0) } ,
49
49
tags: [ . validation, . api] ,
50
- setUpFunction: { blackHole ( repeatString08x16 ) } ) ,
50
+ setUpFunction: { blackHole ( arrayString08x16 ) } ) ,
51
51
52
52
BenchmarkInfo (
53
- name: " FlattenDistanceFromTo.RepeatString.16x08 " ,
54
- runFunction: { with ( repeatString16x08 , $0) } ,
53
+ name: " FlattenDistanceFromTo.Array.String.16.08 " ,
54
+ runFunction: { with ( arrayString16x08 , $0) } ,
55
55
tags: [ . validation, . api] ,
56
- setUpFunction: { blackHole ( repeatString16x08 ) } ) ,
56
+ setUpFunction: { blackHole ( arrayString16x08 ) } ) ,
57
57
58
58
BenchmarkInfo (
59
- name: " FlattenDistanceFromTo.RepeatString.16x16 " ,
60
- runFunction: { with ( repeatString16x16 , $0) } ,
59
+ name: " FlattenDistanceFromTo.Array.String.16.16 " ,
60
+ runFunction: { with ( arrayString16x16 , $0) } ,
61
61
tags: [ . validation, . api] ,
62
- setUpFunction: { blackHole ( repeatString16x16 ) } ) ,
62
+ setUpFunction: { blackHole ( arrayString16x16 ) } ) ,
63
63
]
64
64
65
- // MARK: - Random Access
65
+ // MARK: - Array Array
66
66
67
- func makeRandomAccess(
68
- _ outer: Int ,
69
- _ inner: Int
70
- ) -> FlattenSequence < Repeated < Repeated < Int > > > {
71
- repeatElement ( repeatElement ( 0 , count: inner) , count: outer) . joined ( )
67
+ func makeArrayArray( _ outer: Int , _ inner: Int ) -> FlattenSequence < [ [ UInt8 ] ] > {
68
+ Array ( repeating: Array ( repeating: 123 , count: inner) , count: outer) . joined ( )
72
69
}
73
70
74
- let randomAccess16x16 = makeRandomAccess ( 16 , 16 )
75
- let randomAccess16x32 = makeRandomAccess ( 16 , 32 )
76
- let randomAccess32x16 = makeRandomAccess ( 32 , 16 )
77
- let randomAccess32x32 = makeRandomAccess ( 32 , 32 )
71
+ let arrayArray16x16 = makeArrayArray ( 16 , 16 )
72
+ let arrayArray16x32 = makeArrayArray ( 16 , 32 )
73
+ let arrayArray32x16 = makeArrayArray ( 32 , 16 )
74
+ let arrayArray32x32 = makeArrayArray ( 32 , 32 )
78
75
79
76
@inline ( never)
80
- public func with(
81
- _ collection: FlattenSequence < Repeated < Repeated < Int > > > ,
82
- _ iterations: Int
83
- ) {
77
+ public func with( _ collection: FlattenSequence < [ [ UInt8 ] ] > , _ iterations: Int ) {
84
78
var value = 0 as Int
85
79
86
80
for _ in 0 ..< iterations {
@@ -95,25 +89,19 @@ public func with(
95
89
blackHole ( value == 0 )
96
90
}
97
91
98
- // MARK: - Repeat String
92
+ // MARK: - Array String
99
93
100
- func makeRepeatString(
101
- _ outer: Int ,
102
- _ inner: Int
103
- ) -> FlattenSequence < Repeated < String > > {
104
- repeatElement ( String ( repeating: " 0 " , count: inner) , count: outer) . joined ( )
94
+ func makeArrayString( _ outer: Int , _ inner: Int ) -> FlattenSequence < [ String ] > {
95
+ Array ( repeating: String ( repeating: " 0 " , count: inner) , count: outer) . joined ( )
105
96
}
106
97
107
- let repeatString08x08 = makeRepeatString ( 08 , 08 )
108
- let repeatString08x16 = makeRepeatString ( 08 , 16 )
109
- let repeatString16x08 = makeRepeatString ( 16 , 08 )
110
- let repeatString16x16 = makeRepeatString ( 16 , 16 )
98
+ let arrayString08x08 = makeArrayString ( 08 , 08 )
99
+ let arrayString08x16 = makeArrayString ( 08 , 16 )
100
+ let arrayString16x08 = makeArrayString ( 16 , 08 )
101
+ let arrayString16x16 = makeArrayString ( 16 , 16 )
111
102
112
103
@inline ( never)
113
- public func with(
114
- _ collection: FlattenSequence < Repeated < String > > ,
115
- _ iterations: Int
116
- ) {
104
+ public func with( _ collection: FlattenSequence < [ String ] > , _ iterations: Int ) {
117
105
var value = 0 as Int
118
106
119
107
for _ in 0 ..< iterations {
0 commit comments