Skip to content

Commit a61a756

Browse files
committed
[benchmark] Fix: alphabetic sorting of tests
1 parent 362f925 commit a61a756

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

benchmark/utils/DriverUtils.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,9 @@ struct TestConfig {
174174
tags: Set<BenchmarkCategory>,
175175
skipTags: Set<BenchmarkCategory>
176176
) -> [(index: String, info: BenchmarkInfo)] {
177+
let allTests = registeredBenchmarks.sorted()
177178
let indices = Dictionary(uniqueKeysWithValues:
178-
zip(registeredBenchmarks.sorted().map { $0.name },
179+
zip(allTests.map { $0.name },
179180
(1...).lazy.map { String($0) } ))
180181

181182
func byTags(b: BenchmarkInfo) -> Bool {
@@ -186,7 +187,7 @@ struct TestConfig {
186187
return specifiedTests.contains(b.name) ||
187188
specifiedTests.contains(indices[b.name]!)
188189
} // !! "All registeredBenchmarks have been assigned an index"
189-
return registeredBenchmarks
190+
return allTests
190191
.filter(specifiedTests.isEmpty ? byTags : byNamesOrIndices)
191192
.map { (index: indices[$0.name]!, info: $0) }
192193
}

test/benchmark/Benchmark_O.test.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ ORSKIPTAGS: Fibonacci
8686
ORSKIPTAGS-NOT: RomanNumbers
8787
````
8888

89+
Alphabetic sorting of tests
90+
91+
````
92+
RUN: %Benchmark_O --list \
93+
RUN: | %FileCheck %s --check-prefix ALPHASORT
94+
ALPHASORT: COWArrayGuaranteedParameterOverhead
95+
ALPHASORT: COWTree
96+
ALPHASORT: ChainedFilterMap
97+
ALPHASORT: Chars
98+
ALPHASORT: FatCompactMap
99+
100+
````
101+
89102
## Running Benchmarks
90103
Each real benchmark execution takes about a second per sample. If possible,
91104
multiple checks are combined into one run to minimize the test time.

0 commit comments

Comments
 (0)