Skip to content

Commit aecea33

Browse files
committed
[benchmark] PopFront Legacy Factor
1 parent c087a02 commit aecea33

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

benchmark/single-source/PopFront.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,38 @@
1313
import TestsUtils
1414

1515
public let PopFront = [
16-
BenchmarkInfo(name: "PopFrontArray", runFunction: run_PopFrontArray, tags: [.validation, .api, .Array]),
17-
BenchmarkInfo(name: "PopFrontUnsafePointer", runFunction: run_PopFrontUnsafePointer, tags: [.validation, .api]),
16+
BenchmarkInfo(name: "PopFrontArray",
17+
runFunction: run_PopFrontArray,
18+
tags: [.validation, .api, .Array],
19+
legacyFactor: 20),
20+
BenchmarkInfo(name: "PopFrontUnsafePointer",
21+
runFunction: run_PopFrontUnsafePointer,
22+
tags: [.validation, .api],
23+
legacyFactor: 100),
1824
]
1925

20-
let reps = 1
2126
let arrayCount = 1024
2227

2328
@inline(never)
2429
public func run_PopFrontArray(_ N: Int) {
2530
let orig = Array(repeating: 1, count: arrayCount)
2631
var a = [Int]()
27-
for _ in 1...20*N {
28-
for _ in 1...reps {
32+
for _ in 1...N {
2933
var result = 0
3034
a.append(contentsOf: orig)
3135
while a.count != 0 {
3236
result += a[0]
3337
a.remove(at: 0)
3438
}
3539
CheckResults(result == arrayCount)
36-
}
3740
}
3841
}
3942

4043
@inline(never)
4144
public func run_PopFrontUnsafePointer(_ N: Int) {
4245
var orig = Array(repeating: 1, count: arrayCount)
4346
let a = UnsafeMutablePointer<Int>.allocate(capacity: arrayCount)
44-
for _ in 1...100*N {
45-
for _ in 1...reps {
47+
for _ in 1...N {
4648
for i in 0..<arrayCount {
4749
a[i] = orig[i]
4850
}
@@ -54,8 +56,6 @@ public func run_PopFrontUnsafePointer(_ N: Int) {
5456
count -= 1
5557
}
5658
CheckResults(result == arrayCount)
57-
}
5859
}
5960
a.deallocate()
6061
}
61-

benchmark/single-source/PopFrontGeneric.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import TestsUtils
1515
public let PopFrontArrayGeneric = BenchmarkInfo(
1616
name: "PopFrontArrayGeneric",
1717
runFunction: run_PopFrontArrayGeneric,
18-
tags: [.validation, .api, .Array])
18+
tags: [.validation, .api, .Array],
19+
legacyFactor: 20)
1920

20-
let reps = 1
2121
let arrayCount = 1024
2222

2323
// This test case exposes rdar://17440222 which caused rdar://17974483 (popFront
@@ -50,15 +50,13 @@ func myArrayReplace<
5050
public func run_PopFrontArrayGeneric(_ N: Int) {
5151
let orig = Array(repeating: 1, count: arrayCount)
5252
var a = [Int]()
53-
for _ in 1...20*N {
54-
for _ in 1...reps {
53+
for _ in 1...N {
5554
var result = 0
5655
a.append(contentsOf: orig)
5756
while a.count != 0 {
5857
result += a[0]
5958
myArrayReplace(&a, 0..<1, EmptyCollection())
6059
}
6160
CheckResults(result == arrayCount)
62-
}
6361
}
6462
}

0 commit comments

Comments
 (0)