diff --git a/benchmark/single-source/ArrayAppend.swift b/benchmark/single-source/ArrayAppend.swift index ead10b2da63bf..78cee2d5d1207 100644 --- a/benchmark/single-source/ArrayAppend.swift +++ b/benchmark/single-source/ArrayAppend.swift @@ -42,15 +42,14 @@ public func run_ArrayAppendReserved(_ N: Int) { } // Append a sequence. Length of sequence unknown so -// can't pre-reserve capacity. Should be comparable -// to append single elements. +// can't pre-reserve capacity. @inline(never) public func run_ArrayAppendSequence(_ N: Int) { let seq = stride(from: 0, to: 10_000, by: 1) for _ in 0.. { + var x: T + var y: U +} + +// Append another array. Length of sequence known so +// can pre-reserve capacity. +@inline(never) +public func run_ArrayAppendGenericStructs(_ N: Int) { + let other = Array(repeating: S(x: 3, y: 4.2), count: 10_000) + for _ in 0..]() + for _ in 0..<8 { + nums += other + } + } + } +} + +// Append another array. Length of sequence known so +// can pre-reserve capacity. +@inline(never) +public func run_ArrayAppendOptionals(_ N: Int) { + let other: [Int?] = Array(repeating: 1, count: 10_000) + + for _ in 0..