Skip to content

Commit 8944591

Browse files
committed
[benchmark] Simplify benchmark registration
1 parent 8910b75 commit 8944591

File tree

184 files changed

+1114
-957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+1114
-957
lines changed

benchmark/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ set(SWIFT_BENCH_MODULES
5959
single-source/CharacterProperties
6060
single-source/Chars
6161
single-source/ClassArrayGetter
62-
single-source/Codable
62+
single-source/CodableTest
6363
single-source/Combos
6464
single-source/DataBenchmarks
6565
single-source/DeadArray
@@ -76,7 +76,7 @@ set(SWIFT_BENCH_MODULES
7676
single-source/DictionaryCopy
7777
single-source/DictionaryGroup
7878
single-source/DictionaryKeysContains
79-
single-source/DictionaryLiteral
79+
single-source/DictionaryLiteralTest
8080
single-source/DictionaryOfAnyHashableStrings
8181
single-source/DictionaryRemove
8282
single-source/DictionarySubscriptDefault
@@ -112,11 +112,11 @@ set(SWIFT_BENCH_MODULES
112112
single-source/LuhnAlgoLazy
113113
single-source/MapReduce
114114
single-source/Memset
115-
single-source/Mirror
115+
single-source/MirrorTest
116116
single-source/MonteCarloE
117117
single-source/MonteCarloPi
118118
single-source/NSDictionaryCastToSwift
119-
single-source/NSError
119+
single-source/NSErrorTest
120120
single-source/NSStringConversion
121121
single-source/NibbleSort
122122
single-source/NIOChannelPipeline
@@ -143,7 +143,7 @@ set(SWIFT_BENCH_MODULES
143143
single-source/ProtocolConformance
144144
single-source/ProtocolDispatch
145145
single-source/ProtocolDispatch2
146-
single-source/Queue
146+
single-source/QueueTest
147147
single-source/RC4
148148
single-source/RGBHistogram
149149
single-source/Radix2CooleyTukey
@@ -186,7 +186,7 @@ set(SWIFT_BENCH_MODULES
186186
single-source/StringSwitch
187187
single-source/StringTests
188188
single-source/StringWalk
189-
single-source/Substring
189+
single-source/SubstringTest
190190
single-source/Suffix
191191
single-source/SuperChars
192192
single-source/TwoSum

benchmark/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,12 @@ If needed you can multiply N by a fixed amount (e.g. `1...100*N`) to achieve thi
290290
// rdar://problem/00000000
291291
import TestsUtils
292292
293-
public let YourTestName = BenchmarkInfo(
294-
name: "YourTestName",
295-
runFunction: run_YourTestName,
296-
tags: [.regression])
293+
public let benchmarks = [
294+
BenchmarkInfo(
295+
name: "YourTestName",
296+
runFunction: run_YourTestName,
297+
tags: [.regression])
298+
]
297299
298300
@inline(never)
299301
public func run_YourTestName(n: Int) {

benchmark/cxx-source/CreateObjects.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
import TestsUtils
1717
import CxxCreateObjects
1818

19-
public let CreateObjects = BenchmarkInfo(
20-
name: "CreateObjects",
21-
runFunction: run_CreateObjects,
22-
tags: [.validation, .bridging])
19+
public let benchmarks = [
20+
BenchmarkInfo(
21+
name: "CreateObjects",
22+
runFunction: run_CreateObjects,
23+
tags: [.validation, .bridging])
24+
]
2325

2426
@inline(never)
2527
public func run_CreateObjects(_ n: Int) {

benchmark/multi-source/PrimsSplit/Prims_main.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212

1313
import TestsUtils
1414

15-
public let PrimsSplit = BenchmarkInfo(
16-
name: "PrimsSplit",
17-
runFunction: run_PrimsSplit,
18-
tags: [.validation, .algorithm],
19-
legacyFactor: 5)
15+
public let benchmarks = [
16+
BenchmarkInfo(
17+
name: "PrimsSplit",
18+
runFunction: run_PrimsSplit,
19+
tags: [.validation, .algorithm],
20+
legacyFactor: 5)
21+
]
2022

2123
@inline(never)
2224
public func run_PrimsSplit(_ n: Int) {

benchmark/single-source/Ackermann.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -14,10 +14,12 @@
1414
// for performance measuring.
1515
import TestsUtils
1616

17-
public let Ackermann = BenchmarkInfo(
18-
name: "Ackermann",
19-
runFunction: run_Ackermann,
20-
tags: [.algorithm])
17+
public let benchmarks = [
18+
BenchmarkInfo(
19+
name: "Ackermann",
20+
runFunction: run_Ackermann,
21+
tags: [.algorithm]),
22+
]
2123

2224
func _ackermann(_ m: Int, _ n : Int) -> Int {
2325
if (m == 0) { return n + 1 }

benchmark/single-source/AngryPhonebook.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -16,7 +16,7 @@ import TestsUtils
1616

1717
let t: [BenchmarkCategory] = [.validation, .api, .String]
1818

19-
public let AngryPhonebook = [
19+
public let benchmarks = [
2020
BenchmarkInfo(
2121
name: "AngryPhonebook",
2222
runFunction: run_AngryPhonebook,

benchmark/single-source/AnyHashableWithAClass.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -22,12 +22,14 @@ import TestsUtils
2222
// 11% _swift_stdlib_makeAnyHashableUpcastingToHashableBaseType
2323
// 16% _swift_retain_[n]
2424
// 5% swift_conformsToProtocol
25-
public let AnyHashableWithAClass = BenchmarkInfo(
26-
name: "AnyHashableWithAClass",
27-
runFunction: run_AnyHashableWithAClass,
28-
tags: [.abstraction, .runtime, .cpubench],
29-
legacyFactor: 500
30-
)
25+
public let benchmarks = [
26+
BenchmarkInfo(
27+
name: "AnyHashableWithAClass",
28+
runFunction: run_AnyHashableWithAClass,
29+
tags: [.abstraction, .runtime, .cpubench],
30+
legacyFactor: 500
31+
),
32+
]
3133

3234
class TestHashableBase : Hashable {
3335
var value: Int

benchmark/single-source/Array2D.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -12,13 +12,15 @@
1212

1313
import TestsUtils
1414

15-
public let Array2D = BenchmarkInfo(
16-
name: "Array2D",
17-
runFunction: run_Array2D,
18-
tags: [.validation, .api, .Array],
19-
setUpFunction: { blackHole(inputArray) },
20-
tearDownFunction: { inputArray = nil },
21-
legacyFactor: 16)
15+
public let benchmarks = [
16+
BenchmarkInfo(
17+
name: "Array2D",
18+
runFunction: run_Array2D,
19+
tags: [.validation, .api, .Array],
20+
setUpFunction: { blackHole(inputArray) },
21+
tearDownFunction: { inputArray = nil },
22+
legacyFactor: 16),
23+
]
2224

2325
let size = 256
2426

benchmark/single-source/ArrayAppend.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -15,7 +15,7 @@
1515
import TestsUtils
1616

1717
let t: [BenchmarkCategory] = [.validation, .api, .Array]
18-
public let ArrayAppend = [
18+
public let benchmarks = [
1919
BenchmarkInfo(name: "ArrayAppend", runFunction: run_ArrayAppend, tags: t, legacyFactor: 10),
2020
BenchmarkInfo(name: "ArrayAppendArrayOfInt", runFunction: run_ArrayAppendArrayOfInt, tags: t,
2121
setUpFunction: ones, tearDownFunction: releaseOnes, legacyFactor: 10),

benchmark/single-source/ArrayInClass.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
public let ArrayInClass = [
14+
public let benchmarks = [
1515
BenchmarkInfo(
1616
name: "ArrayInClass",
1717
runFunction: run_ArrayInClass,

0 commit comments

Comments
 (0)