@@ -42,6 +42,18 @@ public let UTF8Decode = [
42
42
name: " UTF8Decode_InitFromBytes_ascii " ,
43
43
runFunction: run_UTF8Decode_InitFromBytes_ascii,
44
44
tags: [ . validation, . api, . String] ) ,
45
+ BenchmarkInfo (
46
+ name: " UTF8Decode_InitFromData_ascii_as_ascii " ,
47
+ runFunction: run_UTF8Decode_InitFromData_ascii_as_ascii,
48
+ tags: [ . validation, . api, . String] ) ,
49
+ BenchmarkInfo (
50
+ name: " UTF8Decode_InitDecoding_ascii_as_ascii " ,
51
+ runFunction: run_UTF8Decode_InitDecoding_ascii_as_ascii,
52
+ tags: [ . validation, . api, . String] ) ,
53
+ BenchmarkInfo (
54
+ name: " UTF8Decode_InitFromBytes_ascii_as_ascii " ,
55
+ runFunction: run_UTF8Decode_InitFromBytes_ascii_as_ascii,
56
+ tags: [ . validation, . api, . String] ) ,
45
57
]
46
58
47
59
// 1-byte sequences
@@ -129,4 +141,26 @@ public func run_UTF8Decode_InitFromBytes_ascii(_ N: Int) {
129
141
}
130
142
}
131
143
144
+ @inline ( never)
145
+ public func run_UTF8Decode_InitFromData_ascii_as_ascii( _ N: Int ) {
146
+ let input = asciiData
147
+ for _ in 0 ..< 1_000 * N {
148
+ blackHole ( String ( data: input, encoding: . ascii) )
149
+ }
150
+ }
151
+ @inline ( never)
152
+ public func run_UTF8Decode_InitDecoding_ascii_as_ascii( _ N: Int ) {
153
+ let input = asciiBytes
154
+ for _ in 0 ..< 1_000 * N {
155
+ blackHole ( String ( decoding: input, as: Unicode . ASCII. self) )
156
+ }
157
+ }
158
+ @inline ( never)
159
+ public func run_UTF8Decode_InitFromBytes_ascii_as_ascii( _ N: Int ) {
160
+ let input = asciiBytes
161
+ for _ in 0 ..< 1_000 * N {
162
+ blackHole ( String ( bytes: input, encoding: . ascii) )
163
+ }
164
+ }
165
+
132
166
0 commit comments