Skip to content

Commit 6133471

Browse files
switch var to let in benchmark directory
1 parent d9f0ec0 commit 6133471

19 files changed

+32
-32
lines changed

benchmark/single-source/AngryPhonebook.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public let AngryPhonebook = BenchmarkInfo(
2121
tags: [.validation, .api, .String],
2222
legacyFactor: 7)
2323

24-
var words = [
24+
let words = [
2525
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
2626
"Charles", "Thomas", "Christopher", "Daniel", "Matthew", "Donald", "Anthony",
2727
"Paul", "Mark", "George", "Steven", "Kenneth", "Andrew", "Edward", "Brian",

benchmark/single-source/AnyHashableWithAClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import TestsUtils
2222
// 11% _swift_stdlib_makeAnyHashableUpcastingToHashableBaseType
2323
// 16% _swift_retain_[n]
2424
// 5% swift_conformsToProtocol
25-
public var AnyHashableWithAClass = BenchmarkInfo(
25+
public let AnyHashableWithAClass = BenchmarkInfo(
2626
name: "AnyHashableWithAClass",
2727
runFunction: run_AnyHashableWithAClass,
2828
tags: [.abstraction, .runtime, .cpubench],

benchmark/single-source/ArrayOfGenericPOD.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public func run_ArrayOfGenericPOD(_ N: Int) {
7676

7777
// --- ArrayInitFromSlice
7878

79-
var globalArray = Array<UInt8>(repeating: 0, count: 4096)
79+
let globalArray = Array<UInt8>(repeating: 0, count: 4096)
8080

8181
func createArrayOfPOD() {
8282
blackHole(globalArray)

benchmark/single-source/ArraySetElement.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import TestsUtils
1515
// 33% isUniquelyReferenced
1616
// 15% swift_rt_swift_isUniquelyReferencedOrPinned_nonNull_native
1717
// 18% swift_isUniquelyReferencedOrPinned_nonNull_native
18-
public var ArraySetElement = BenchmarkInfo(
18+
public let ArraySetElement = BenchmarkInfo(
1919
name: "ArraySetElement",
2020
runFunction: run_ArraySetElement,
2121
tags: [.runtime, .cpubench]

benchmark/single-source/ChainedFilterMap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import TestsUtils
22

3-
public var ChainedFilterMap = [
3+
public let ChainedFilterMap = [
44
BenchmarkInfo(name: "ChainedFilterMap", runFunction: run_ChainedFilterMap,
55
tags: [.algorithm], setUpFunction: { blackHole(first100k) },
66
legacyFactor: 9),

benchmark/single-source/Chars.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public let Chars = BenchmarkInfo(
2020
setUpFunction: { blackHole(alphabetInput) },
2121
legacyFactor: 50)
2222

23-
var alphabetInput: [Character] = [
23+
let alphabetInput: [Character] = [
2424
"A", "B", "C", "D", "E", "F", "G",
2525
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
2626
"S", "T", "U",

benchmark/single-source/Hash.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Hash {
127127
final
128128
class MD5 : Hash {
129129
// Integer part of the sines of integers (in radians) * 2^32.
130-
var k : [UInt32] = [0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee ,
130+
let k : [UInt32] = [0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee ,
131131
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501 ,
132132
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be ,
133133
0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 ,
@@ -145,7 +145,7 @@ class MD5 : Hash {
145145
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 ]
146146

147147
// Per-round shift amounts
148-
var r : [UInt32] = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
148+
let r : [UInt32] = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
149149
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
150150
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
151151
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]
@@ -433,7 +433,7 @@ class SHA256 : Hash {
433433
var h6: UInt32 = 0
434434
var h7: UInt32 = 0
435435

436-
var k : [UInt32] = [
436+
let k : [UInt32] = [
437437
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
438438
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
439439
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,

benchmark/single-source/LuhnAlgoEager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import TestsUtils
77

8-
public var LuhnAlgoEager = BenchmarkInfo(
8+
public let LuhnAlgoEager = BenchmarkInfo(
99
name: "LuhnAlgoEager",
1010
runFunction: run_LuhnAlgoEager,
1111
tags: [.algorithm]

benchmark/single-source/LuhnAlgoLazy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import TestsUtils
77

8-
public var LuhnAlgoLazy = BenchmarkInfo(
8+
public let LuhnAlgoLazy = BenchmarkInfo(
99
name: "LuhnAlgoLazy",
1010
runFunction: run_LuhnAlgoLazy,
1111
tags: [.algorithm]

benchmark/single-source/NibbleSort.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import TestsUtils
66

7-
public var NibbleSort = BenchmarkInfo(
7+
public let NibbleSort = BenchmarkInfo(
88
name: "NibbleSort",
99
runFunction: run_NibbleSort,
1010
tags: [.validation],

benchmark/single-source/PolymorphicCalls.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ applying a jump-threading in combination with the speculative devirtualization.
2222

2323
import TestsUtils
2424

25-
public var PolymorphicCalls = BenchmarkInfo(
25+
public let PolymorphicCalls = BenchmarkInfo(
2626
name: "PolymorphicCalls",
2727
runFunction: run_PolymorphicCalls,
2828
tags: [.abstraction, .cpubench]

benchmark/single-source/PopFront.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public func run_PopFrontArray(_ N: Int) {
4242

4343
@inline(never)
4444
public func run_PopFrontUnsafePointer(_ N: Int) {
45-
var orig = Array(repeating: 1, count: arrayCount)
45+
let orig = Array(repeating: 1, count: arrayCount)
4646
let a = UnsafeMutablePointer<Int>.allocate(capacity: arrayCount)
4747
for _ in 1...N {
4848
for i in 0..<arrayCount {

benchmark/single-source/SevenBoom.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import Foundation
2222
// 7% objc_msgSend
2323
// 5% _swift_release_
2424
// 2% _swift_retain_
25-
public var SevenBoom = BenchmarkInfo(
25+
public let SevenBoom = BenchmarkInfo(
2626
name: "SevenBoom",
2727
runFunction: run_SevenBoom,
2828
tags: [.runtime, .exceptions, .bridging, .cpubench]

benchmark/single-source/SortStrings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ public func run_SortSortedStrings(_ N: Int) {
10501050
}
10511051
}
10521052

1053-
var unicodeWords: [String] = [
1053+
let unicodeWords: [String] = [
10541054
"❄️woodshed",
10551055
"❄️lakism",
10561056
"❄️gastroperiodynia",

benchmark/single-source/StrComplexWalk.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public let StrComplexWalk = BenchmarkInfo(
2020

2121
@inline(never)
2222
public func run_StrComplexWalk(_ N: Int) {
23-
var s = "निरन्तरान्धकारिता-दिगन्तर-कन्दलदमन्द-सुधारस-बिन्दु-सान्द्रतर-घनाघन-वृन्द-सन्देहकर-स्यन्दमान-मकरन्द-बिन्दु-बन्धुरतर-माकन्द-तरु-कुल-तल्प-कल्प-मृदुल-सिकता-जाल-जटिल-मूल-तल-मरुवक-मिलदलघु-लघु-लय-कलित-रमणीय-पानीय-शालिका-बालिका-करार-विन्द-गलन्तिका-गलदेला-लवङ्ग-पाटल-घनसार-कस्तूरिकातिसौरभ-मेदुर-लघुतर-मधुर-शीतलतर-सलिलधारा-निराकरिष्णु-तदीय-विमल-विलोचन-मयूख-रेखापसारित-पिपासायास-पथिक-लोकान्"
23+
let s = "निरन्तरान्धकारिता-दिगन्तर-कन्दलदमन्द-सुधारस-बिन्दु-सान्द्रतर-घनाघन-वृन्द-सन्देहकर-स्यन्दमान-मकरन्द-बिन्दु-बन्धुरतर-माकन्द-तरु-कुल-तल्प-कल्प-मृदुल-सिकता-जाल-जटिल-मूल-तल-मरुवक-मिलदलघु-लघु-लय-कलित-रमणीय-पानीय-शालिका-बालिका-करार-विन्द-गलन्तिका-गलदेला-लवङ्ग-पाटल-घनसार-कस्तूरिकातिसौरभ-मेदुर-लघुतर-मधुर-शीतलतर-सलिलधारा-निराकरिष्णु-तदीय-विमल-विलोचन-मयूख-रेखापसारित-पिपासायास-पथिक-लोकान्"
2424
let ref_result = 379
2525
for _ in 1...200*N {
2626
var count = 0

benchmark/single-source/StringComparison.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,23 +208,23 @@ public let StringNormalization: [BenchmarkInfo] = [
208208
),
209209
]
210210

211-
var Workload_ascii: Workload! = Workload.ascii
211+
let Workload_ascii: Workload! = Workload.ascii
212212

213-
var Workload_latin1: Workload! = Workload.latin1
213+
let Workload_latin1: Workload! = Workload.latin1
214214

215-
var Workload_fastPrenormal: Workload! = Workload.fastPrenormal
215+
let Workload_fastPrenormal: Workload! = Workload.fastPrenormal
216216

217-
var Workload_slowerPrenormal: Workload! = Workload.slowerPrenormal
217+
let Workload_slowerPrenormal: Workload! = Workload.slowerPrenormal
218218

219-
var Workload_nonBMPSlowestPrenormal: Workload! = Workload.nonBMPSlowestPrenormal
219+
let Workload_nonBMPSlowestPrenormal: Workload! = Workload.nonBMPSlowestPrenormal
220220

221-
var Workload_emoji: Workload! = Workload.emoji
221+
let Workload_emoji: Workload! = Workload.emoji
222222

223-
var Workload_abnormal: Workload! = Workload.abnormal
223+
let Workload_abnormal: Workload! = Workload.abnormal
224224

225-
var Workload_zalgo: Workload! = Workload.zalgo
225+
let Workload_zalgo: Workload! = Workload.zalgo
226226

227-
var Workload_longSharedPrefix: Workload! = Workload.longSharedPrefix
227+
let Workload_longSharedPrefix: Workload! = Workload.longSharedPrefix
228228

229229

230230
@inline(never)

benchmark/single-source/StringEdits.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public let StringEdits = BenchmarkInfo(
2323
tags: [.validation, .api, .String],
2424
legacyFactor: 100)
2525

26-
var editWords: [String] = [
26+
let editWords: [String] = [
2727
"woodshed",
2828
"lakism",
2929
"gastroperiodynia",

benchmark/single-source/StringWalk.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ let charactersMultiplier = baseMultiplier / 5
9191

9292
// An extended benchmark suite exercising finer-granularity behavior of our
9393
// Strings.
94-
public var StringWalk = [
94+
public let StringWalk = [
9595
BenchmarkInfo(
9696
name: "StringWalk",
9797
runFunction: run_StringWalk,

benchmark/single-source/Walsh.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func IsPowerOfTwo(_ x: Int) -> Bool { return (x & (x - 1)) == 0 }
2828
func WalshTransform(_ data: inout [Double]) {
2929
assert(IsPowerOfTwo(data.count), "Not a power of two")
3030
var temp = [Double](repeating: 0, count: data.count)
31-
var ret = WalshImpl(&data, &temp, 0, data.count)
31+
let ret = WalshImpl(&data, &temp, 0, data.count)
3232
for i in 0..<data.count {
3333
data[i] = ret[i]
3434
}
@@ -59,11 +59,11 @@ func WalshImpl(_ data: inout [Double], _ temp: inout [Double], _ start: Int, _ s
5959
}
6060

6161
func checkCorrectness() {
62-
var In : [Double] = [1,0,1,0,0,1,1,0]
63-
var Out : [Double] = [4,2,0,-2,0,2,0,2]
62+
let In : [Double] = [1,0,1,0,0,1,1,0]
63+
let Out : [Double] = [4,2,0,-2,0,2,0,2]
6464
var data : [Double] = In
6565
WalshTransform(&data)
66-
var mid = data
66+
let mid = data
6767
InverseWalshTransform(&data)
6868
for i in 0..<In.count {
6969
// Check encode.

0 commit comments

Comments
 (0)