@@ -95,7 +95,7 @@ public let DataBenchmarks = [
95
95
runFunction: run_ReplaceLargeBuffer, tags: skip) ,
96
96
97
97
BenchmarkInfo ( name: " DataAppendSequence " ,
98
- runFunction: run_AppendSequence , tags: d) ,
98
+ runFunction: { append ( $0 , sequenceLength : 809 , to : medium ) } , tags: d) ,
99
99
100
100
BenchmarkInfo ( name: " DataAppendDataSmallToSmall " ,
101
101
runFunction: { append ( $0, data: small, to: small) } , tags: d) ,
@@ -232,11 +232,12 @@ func append(_ N: Int, arraySize: Int, to data: Data) {
232
232
}
233
233
}
234
234
235
- func benchmark_AppendSequence( _ N: Int , _ count: Int , _ data_: Data ) {
236
- let bytes = repeatElement ( UInt8 ( 0xA0 ) , count: count)
235
+ @inline ( never)
236
+ func append( _ N: Int , sequenceLength: Int , to data: Data ) {
237
+ let bytes = repeatElement ( UInt8 ( 0xA0 ) , count: sequenceLength)
237
238
for _ in 0 ..< 10000 * N {
238
- var data = data_
239
- data . append ( contentsOf: bytes)
239
+ var copy = data
240
+ copy . append ( contentsOf: bytes)
240
241
}
241
242
}
242
243
@@ -345,12 +346,6 @@ public func run_ReplaceLargeBuffer(_ N: Int) {
345
346
}
346
347
}
347
348
348
- @inline ( never)
349
- public func run_AppendSequence( _ N: Int ) {
350
- let data = sampleData ( . medium)
351
- benchmark_AppendSequence ( N, 809 , data)
352
- }
353
-
354
349
@inline ( never)
355
350
public func run_DataToStringEmpty( _ N: Int ) {
356
351
let d = Data ( )
0 commit comments