Skip to content

Commit 6a657bc

Browse files
committed
[benchmark] Queue Legacy Factor
1 parent 1a72543 commit 6a657bc

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

benchmark/single-source/Queue.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ public let QueueGeneric = BenchmarkInfo(
1717
runFunction: run_QueueGeneric,
1818
tags: [.validation, .api],
1919
setUpFunction: { buildWorkload() },
20-
tearDownFunction: nil)
20+
legacyFactor: 10)
2121

2222
public let QueueConcrete = BenchmarkInfo(
2323
name: "QueueConcrete",
2424
runFunction: run_QueueConcrete,
2525
tags: [.validation, .api],
2626
setUpFunction: { buildWorkload() },
27-
tearDownFunction: nil)
28-
27+
legacyFactor: 10)
28+
2929
// TODO: remove when there is a native equivalent in the std lib
3030
extension RangeReplaceableCollection where Self: BidirectionalCollection {
3131
public mutating func popLast() -> Element? {
@@ -40,14 +40,14 @@ where Storage: BidirectionalCollection {
4040

4141
internal var _in: Storage
4242
internal var _out: Storage
43-
43+
4444
public init() {
4545
_in = Storage()
4646
_out = Storage()
4747
}
4848
}
4949

50-
extension Queue {
50+
extension Queue {
5151
public mutating func enqueue(_ newElement: Element) {
5252
_in.append(newElement)
5353
}
@@ -72,7 +72,7 @@ where Elements.Element: Equatable {
7272
CheckResults(j == elements.count*2)
7373
}
7474

75-
let n = 10_000
75+
let n = 1_000
7676
let workload = (0..<n).map { "\($0): A long enough string to defeat the SSO, or so I hope." }
7777

7878
public func buildWorkload() {
@@ -90,14 +90,14 @@ func run_QueueGeneric(_ scale: Int) {
9090
public struct ConcreteQueue {
9191
internal var _in: [String]
9292
internal var _out: [String]
93-
93+
9494
public init() {
9595
_in = Array()
9696
_out = Array()
9797
}
9898
}
9999

100-
extension ConcreteQueue {
100+
extension ConcreteQueue {
101101
public mutating func enqueue(_ newElement: String) {
102102
_in.append(newElement)
103103
}
@@ -128,4 +128,3 @@ func run_QueueConcrete(_ scale: Int) {
128128
testConcreteQueue(elements: workload)
129129
}
130130
}
131-

0 commit comments

Comments
 (0)