Skip to content

Commit 758c52b

Browse files
committed
[benchmark] Don't create array instance in modules with solitary benchmarks
It just produces unnecessary code sign churn.
1 parent 110d123 commit 758c52b

Some content is hidden

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

65 files changed

+117
-177
lines changed

benchmark/single-source/Ackermann.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
// for performance measuring.
1515
import TestsUtils
1616

17-
public let benchmarks = [
17+
public let benchmarks =
1818
BenchmarkInfo(
1919
name: "Ackermann",
2020
runFunction: run_Ackermann,
21-
tags: [.algorithm]),
22-
]
21+
tags: [.algorithm])
2322

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

benchmark/single-source/AnyHashableWithAClass.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ import TestsUtils
2222
// 11% _swift_stdlib_makeAnyHashableUpcastingToHashableBaseType
2323
// 16% _swift_retain_[n]
2424
// 5% swift_conformsToProtocol
25-
public let benchmarks = [
25+
public let benchmarks =
2626
BenchmarkInfo(
2727
name: "AnyHashableWithAClass",
2828
runFunction: run_AnyHashableWithAClass,
2929
tags: [.abstraction, .runtime, .cpubench],
3030
legacyFactor: 500
31-
),
32-
]
31+
)
3332

3433
class TestHashableBase : Hashable {
3534
var value: Int

benchmark/single-source/Array2D.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212

1313
import TestsUtils
1414

15-
public let benchmarks = [
15+
public let benchmarks =
1616
BenchmarkInfo(
1717
name: "Array2D",
1818
runFunction: run_Array2D,
1919
tags: [.validation, .api, .Array],
2020
setUpFunction: { blackHole(inputArray) },
2121
tearDownFunction: { inputArray = nil },
22-
legacyFactor: 16),
23-
]
22+
legacyFactor: 16)
2423

2524
let size = 256
2625

benchmark/single-source/ArrayOfGenericRef.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717

1818
import TestsUtils
1919

20-
public let benchmarks = [
20+
public let benchmarks =
2121
BenchmarkInfo(
2222
name: "ArrayOfGenericRef",
2323
runFunction: run_ArrayOfGenericRef,
2424
tags: [.validation, .api, .Array],
2525
legacyFactor: 10)
26-
]
2726

2827
protocol Constructible {
2928
associatedtype Element

benchmark/single-source/ArrayOfPOD.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818

1919
import TestsUtils
2020

21-
public let benchmarks = [
21+
public let benchmarks =
2222
BenchmarkInfo(
2323
name: "ArrayOfPOD",
2424
runFunction: run_ArrayOfPOD,
2525
tags: [.validation, .api, .Array])
26-
]
2726

2827
class RefArray<T> {
2928
var array : [T]

benchmark/single-source/ArrayOfRef.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818

1919
import TestsUtils
2020

21-
public let benchmarks = [
21+
public let benchmarks =
2222
BenchmarkInfo(
2323
name: "ArrayOfRef",
2424
runFunction: run_ArrayOfRef,
2525
tags: [.validation, .api, .Array],
2626
legacyFactor: 10)
27-
]
2827

2928
protocol Constructible {
3029
associatedtype Element

benchmark/single-source/ArraySetElement.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ import TestsUtils
1515
// 33% isUniquelyReferenced
1616
// 15% swift_rt_swift_isUniquelyReferencedOrPinned_nonNull_native
1717
// 18% swift_isUniquelyReferencedOrPinned_nonNull_native
18-
public let benchmarks = [
18+
public let benchmarks =
1919
BenchmarkInfo(
2020
name: "ArraySetElement",
2121
runFunction: run_ArraySetElement,
2222
tags: [.runtime, .cpubench]
23-
),
24-
]
23+
)
2524

2625
// This is an effort to defeat isUniquelyReferenced optimization. Ideally
2726
// microbenchmarks list this should be written in C.

benchmark/single-source/ArraySubscript.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
// This test checks the performance of modifying an array element.
1414
import TestsUtils
1515

16-
public let benchmarks = [
16+
public let benchmarks =
1717
BenchmarkInfo(
1818
name: "ArraySubscript",
1919
runFunction: run_ArraySubscript,
2020
tags: [.validation, .api, .Array],
21-
legacyFactor: 4),
22-
]
21+
legacyFactor: 4)
2322

2423
@inline(never)
2524
public func run_ArraySubscript(_ n: Int) {

benchmark/single-source/BitCount.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
// rdar://problem/22151678
1616
import TestsUtils
1717

18-
public let benchmarks = [
18+
public let benchmarks =
1919
BenchmarkInfo(
2020
name: "BitCount",
2121
runFunction: run_BitCount,
22-
tags: [.validation, .algorithm]),
23-
]
22+
tags: [.validation, .algorithm])
2423

2524
func countBitSet(_ num: Int) -> Int {
2625
let bits = MemoryLayout<Int>.size * 8

benchmark/single-source/BucketSort.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@
2727

2828
import TestsUtils
2929

30-
public let benchmarks = [
30+
public let benchmarks =
3131
BenchmarkInfo(
3232
name: "BucketSort",
3333
runFunction: run_BucketSort,
3434
tags: [.validation, .algorithm],
3535
setUpFunction: { blackHole(buckets) }
36-
),
37-
]
36+
)
3837

3938
public protocol IntegerConvertible {
4039
func convertToInt() -> Int

benchmark/single-source/ByteSwap.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515

1616
import TestsUtils
1717

18-
public let benchmarks = [
18+
public let benchmarks =
1919
BenchmarkInfo(
2020
name: "ByteSwap",
2121
runFunction: run_ByteSwap,
22-
tags: [.validation, .algorithm]),
23-
]
22+
tags: [.validation, .algorithm])
2423

2524
// a naive O(n) implementation of byteswap.
2625
@inline(never)

benchmark/single-source/COWArrayGuaranteedParameterOverhead.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ import TestsUtils
1515
// This test makes sure that even though we have +0 arguments by default that we
1616
// can properly convert +0 -> +1 to avoid extra COW copies.
1717

18-
public let benchmarks = [
18+
public let benchmarks =
1919
BenchmarkInfo(
2020
name: "COWArrayGuaranteedParameterOverhead",
2121
runFunction: run_COWArrayGuaranteedParameterOverhead,
2222
tags: [.regression, .abstraction, .refcount],
2323
legacyFactor: 50
24-
),
25-
]
24+
)
2625

2726
@inline(never)
2827
func caller() {

benchmark/single-source/Calculator.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212

1313
import TestsUtils
1414

15-
public let benchmarks = [
15+
public let benchmarks =
1616
BenchmarkInfo(
1717
name: "Calculator",
1818
runFunction: run_Calculator,
1919
tags: [.validation])
20-
]
2120

2221
@inline(never)
2322
func my_atoi_impl(_ input : String) -> Int {

benchmark/single-source/CaptureProp.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212

1313
import TestsUtils
1414

15-
public let benchmarks = [
15+
public let benchmarks =
1616
BenchmarkInfo(
1717
name: "CaptureProp",
1818
runFunction: run_CaptureProp,
1919
tags: [.validation, .api, .refcount],
20-
legacyFactor: 10),
21-
]
20+
legacyFactor: 10)
2221

2322
func sum(_ x:Int, y:Int) -> Int {
2423
return x + y

benchmark/single-source/CharacterLiteralsLarge.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
// and retain a StringBuffer.
1616
import TestsUtils
1717

18-
public let benchmarks = [
18+
public let benchmarks =
1919
BenchmarkInfo(
2020
name: "CharacterLiteralsLarge",
2121
runFunction: run_CharacterLiteralsLarge,
2222
tags: [.validation, .api, .String])
23-
]
2423

2524
@inline(never)
2625
func makeCharacter_UTF8Length9() -> Character {

benchmark/single-source/CharacterLiteralsSmall.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
// represented as a packed integer.
1616
import TestsUtils
1717

18-
public let benchmarks = [
18+
public let benchmarks =
1919
BenchmarkInfo(
2020
name: "CharacterLiteralsSmall",
2121
runFunction: run_CharacterLiteralsSmall,
22-
tags: [.validation, .api, .String]),
23-
]
22+
tags: [.validation, .api, .String])
2423

2524
@inline(never)
2625
func makeCharacter_UTF8Length1() -> Character {

benchmark/single-source/Chars.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
// This test tests the performance of ASCII Character comparison.
1414
import TestsUtils
1515

16-
public let benchmarks = [
16+
public let benchmarks =
1717
BenchmarkInfo(
1818
name: "Chars2",
1919
runFunction: run_Chars,
2020
tags: [.validation, .api, .String],
2121
setUpFunction: { blackHole(alphabetInput) },
22-
legacyFactor: 50),
23-
]
22+
legacyFactor: 50)
2423

2524
let alphabetInput: [Character] = [
2625
"A", "B", "C", "D", "E", "F", "G",

benchmark/single-source/ClassArrayGetter.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212

1313
import TestsUtils
1414

15-
public let benchmarks = [
15+
public let benchmarks =
1616
BenchmarkInfo(
1717
name: "ClassArrayGetter2",
1818
runFunction: run_ClassArrayGetter,
1919
tags: [.validation, .api, .Array],
2020
setUpFunction: { blackHole(inputArray) },
2121
tearDownFunction: { inputArray = nil },
22-
legacyFactor: 10),
23-
]
22+
legacyFactor: 10)
2423

2524
class Box {
2625
var v: Int

benchmark/single-source/Combos.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55

66
import TestsUtils
77

8-
public let benchmarks = [
8+
public let benchmarks =
99
BenchmarkInfo(
1010
name: "Combos",
1111
runFunction: run_Combos,
1212
tags: [.validation, .abstraction]
13-
),
14-
]
13+
)
1514

1615
@inline(never)
1716
public func run_Combos(_ n: Int) {

benchmark/single-source/DeadArray.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
// rdar://problem/20980377
1414
import TestsUtils
1515

16-
public let benchmarks = [
16+
public let benchmarks =
1717
BenchmarkInfo(
1818
name: "DeadArray",
1919
runFunction: run_DeadArray,
2020
tags: [.regression, .unstable],
2121
legacyFactor: 200
22-
),
23-
]
22+
)
2423

2524
@inline(__always)
2625
func debug(_ m:String) {}

benchmark/single-source/DictionaryBridge.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
import Foundation
1717
import TestsUtils
1818

19-
public let benchmarks = [
19+
public let benchmarks =
2020
BenchmarkInfo(
2121
name: "DictionaryBridge",
2222
runFunction: run_DictionaryBridge,
23-
tags: [.validation, .api, .Dictionary, .bridging]),
24-
]
23+
tags: [.validation, .api, .Dictionary, .bridging])
2524

2625
#if _runtime(_ObjC)
2726
class Thing : NSObject {

benchmark/single-source/DiffingMyers.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ import TestsUtils
1616
// described in Myers (1986). The Diffing benchmark tracks the performance
1717
// of `Collection.difference(from:to:)`.
1818

19-
public let benchmarks = [
19+
public let benchmarks =
2020
BenchmarkInfo(
2121
name: "Diffing.Myers.Similar",
2222
runFunction: run_Myers,
2323
tags: [.algorithm],
2424
setUpFunction: { blackHole((loremIpsum, unabridgedLorem)) })
25-
]
2625

2726

2827
let loremIpsum = Array("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")

benchmark/single-source/ErrorHandling.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212

1313
import TestsUtils
1414

15-
public let benchmarks = [
15+
public let benchmarks =
1616
BenchmarkInfo(
1717
name: "ErrorHandling",
1818
runFunction: run_ErrorHandling,
1919
tags: [.validation, .exceptions],
20-
legacyFactor: 10),
21-
]
20+
legacyFactor: 10)
2221

2322
enum PizzaError : Error {
2423
case Pepperoni, Olives, Anchovy

benchmark/single-source/Fibonacci.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212

1313
import TestsUtils
1414

15-
public let benchmarks = [
15+
public let benchmarks =
1616
BenchmarkInfo(
1717
name: "Fibonacci",
1818
runFunction: run_Fibonacci,
1919
tags: [.algorithm])
20-
]
2120

2221
func _fibonacci(_ n: Int) -> Int {
2322
if (n <= 2) { return 1 }

benchmark/single-source/Hanoi.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
// <rdar://problem/22151932>
1515
import TestsUtils
1616

17-
public let benchmarks = [
17+
public let benchmarks =
1818
BenchmarkInfo(
1919
name: "Hanoi",
2020
runFunction: run_Hanoi,
2121
tags: [.validation, .algorithm],
22-
legacyFactor: 10),
23-
]
22+
legacyFactor: 10)
2423

2524
struct Move {
2625
var from: String

0 commit comments

Comments
 (0)