Skip to content

switch var to let in benchmark directory #24011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/single-source/AngryPhonebook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public let AngryPhonebook = BenchmarkInfo(
tags: [.validation, .api, .String],
legacyFactor: 7)

var words = [
let words = [
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
"Charles", "Thomas", "Christopher", "Daniel", "Matthew", "Donald", "Anthony",
"Paul", "Mark", "George", "Steven", "Kenneth", "Andrew", "Edward", "Brian",
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/AnyHashableWithAClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import TestsUtils
// 11% _swift_stdlib_makeAnyHashableUpcastingToHashableBaseType
// 16% _swift_retain_[n]
// 5% swift_conformsToProtocol
public var AnyHashableWithAClass = BenchmarkInfo(
public let AnyHashableWithAClass = BenchmarkInfo(
name: "AnyHashableWithAClass",
runFunction: run_AnyHashableWithAClass,
tags: [.abstraction, .runtime, .cpubench],
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/ArrayOfGenericPOD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public func run_ArrayOfGenericPOD(_ N: Int) {

// --- ArrayInitFromSlice

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

func createArrayOfPOD() {
blackHole(globalArray)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/ArraySetElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import TestsUtils
// 33% isUniquelyReferenced
// 15% swift_rt_swift_isUniquelyReferencedOrPinned_nonNull_native
// 18% swift_isUniquelyReferencedOrPinned_nonNull_native
public var ArraySetElement = BenchmarkInfo(
public let ArraySetElement = BenchmarkInfo(
name: "ArraySetElement",
runFunction: run_ArraySetElement,
tags: [.runtime, .cpubench]
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/ChainedFilterMap.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import TestsUtils

public var ChainedFilterMap = [
public let ChainedFilterMap = [
BenchmarkInfo(name: "ChainedFilterMap", runFunction: run_ChainedFilterMap,
tags: [.algorithm], setUpFunction: { blackHole(first100k) },
legacyFactor: 9),
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/Chars.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public let Chars = BenchmarkInfo(
setUpFunction: { blackHole(alphabetInput) },
legacyFactor: 50)

var alphabetInput: [Character] = [
let alphabetInput: [Character] = [
"A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
"S", "T", "U",
Expand Down
6 changes: 3 additions & 3 deletions benchmark/single-source/Hash.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Hash {
final
class MD5 : Hash {
// Integer part of the sines of integers (in radians) * 2^32.
var k : [UInt32] = [0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee ,
let k : [UInt32] = [0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee ,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501 ,
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be ,
0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 ,
Expand All @@ -145,7 +145,7 @@ class MD5 : Hash {
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 ]

// Per-round shift amounts
var r : [UInt32] = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
let r : [UInt32] = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]
Expand Down Expand Up @@ -433,7 +433,7 @@ class SHA256 : Hash {
var h6: UInt32 = 0
var h7: UInt32 = 0

var k : [UInt32] = [
let k : [UInt32] = [
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/LuhnAlgoEager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import TestsUtils

public var LuhnAlgoEager = BenchmarkInfo(
public let LuhnAlgoEager = BenchmarkInfo(
name: "LuhnAlgoEager",
runFunction: run_LuhnAlgoEager,
tags: [.algorithm]
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/LuhnAlgoLazy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import TestsUtils

public var LuhnAlgoLazy = BenchmarkInfo(
public let LuhnAlgoLazy = BenchmarkInfo(
name: "LuhnAlgoLazy",
runFunction: run_LuhnAlgoLazy,
tags: [.algorithm]
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/NibbleSort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import TestsUtils

public var NibbleSort = BenchmarkInfo(
public let NibbleSort = BenchmarkInfo(
name: "NibbleSort",
runFunction: run_NibbleSort,
tags: [.validation],
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/PolymorphicCalls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ applying a jump-threading in combination with the speculative devirtualization.

import TestsUtils

public var PolymorphicCalls = BenchmarkInfo(
public let PolymorphicCalls = BenchmarkInfo(
name: "PolymorphicCalls",
runFunction: run_PolymorphicCalls,
tags: [.abstraction, .cpubench]
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/PopFront.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public func run_PopFrontArray(_ N: Int) {

@inline(never)
public func run_PopFrontUnsafePointer(_ N: Int) {
var orig = Array(repeating: 1, count: arrayCount)
let orig = Array(repeating: 1, count: arrayCount)
let a = UnsafeMutablePointer<Int>.allocate(capacity: arrayCount)
for _ in 1...N {
for i in 0..<arrayCount {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/SevenBoom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Foundation
// 7% objc_msgSend
// 5% _swift_release_
// 2% _swift_retain_
public var SevenBoom = BenchmarkInfo(
public let SevenBoom = BenchmarkInfo(
name: "SevenBoom",
runFunction: run_SevenBoom,
tags: [.runtime, .exceptions, .bridging, .cpubench]
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/SortStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ public func run_SortSortedStrings(_ N: Int) {
}
}

var unicodeWords: [String] = [
let unicodeWords: [String] = [
"❄️woodshed",
"❄️lakism",
"❄️gastroperiodynia",
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/StrComplexWalk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public let StrComplexWalk = BenchmarkInfo(

@inline(never)
public func run_StrComplexWalk(_ N: Int) {
var s = "निरन्तरान्धकारिता-दिगन्तर-कन्दलदमन्द-सुधारस-बिन्दु-सान्द्रतर-घनाघन-वृन्द-सन्देहकर-स्यन्दमान-मकरन्द-बिन्दु-बन्धुरतर-माकन्द-तरु-कुल-तल्प-कल्प-मृदुल-सिकता-जाल-जटिल-मूल-तल-मरुवक-मिलदलघु-लघु-लय-कलित-रमणीय-पानीय-शालिका-बालिका-करार-विन्द-गलन्तिका-गलदेला-लवङ्ग-पाटल-घनसार-कस्तूरिकातिसौरभ-मेदुर-लघुतर-मधुर-शीतलतर-सलिलधारा-निराकरिष्णु-तदीय-विमल-विलोचन-मयूख-रेखापसारित-पिपासायास-पथिक-लोकान्"
let s = "निरन्तरान्धकारिता-दिगन्तर-कन्दलदमन्द-सुधारस-बिन्दु-सान्द्रतर-घनाघन-वृन्द-सन्देहकर-स्यन्दमान-मकरन्द-बिन्दु-बन्धुरतर-माकन्द-तरु-कुल-तल्प-कल्प-मृदुल-सिकता-जाल-जटिल-मूल-तल-मरुवक-मिलदलघु-लघु-लय-कलित-रमणीय-पानीय-शालिका-बालिका-करार-विन्द-गलन्तिका-गलदेला-लवङ्ग-पाटल-घनसार-कस्तूरिकातिसौरभ-मेदुर-लघुतर-मधुर-शीतलतर-सलिलधारा-निराकरिष्णु-तदीय-विमल-विलोचन-मयूख-रेखापसारित-पिपासायास-पथिक-लोकान्"
let ref_result = 379
for _ in 1...200*N {
var count = 0
Expand Down
18 changes: 9 additions & 9 deletions benchmark/single-source/StringComparison.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,23 +208,23 @@ public let StringNormalization: [BenchmarkInfo] = [
),
]

var Workload_ascii: Workload! = Workload.ascii
let Workload_ascii: Workload! = Workload.ascii

var Workload_latin1: Workload! = Workload.latin1
let Workload_latin1: Workload! = Workload.latin1

var Workload_fastPrenormal: Workload! = Workload.fastPrenormal
let Workload_fastPrenormal: Workload! = Workload.fastPrenormal

var Workload_slowerPrenormal: Workload! = Workload.slowerPrenormal
let Workload_slowerPrenormal: Workload! = Workload.slowerPrenormal

var Workload_nonBMPSlowestPrenormal: Workload! = Workload.nonBMPSlowestPrenormal
let Workload_nonBMPSlowestPrenormal: Workload! = Workload.nonBMPSlowestPrenormal

var Workload_emoji: Workload! = Workload.emoji
let Workload_emoji: Workload! = Workload.emoji

var Workload_abnormal: Workload! = Workload.abnormal
let Workload_abnormal: Workload! = Workload.abnormal

var Workload_zalgo: Workload! = Workload.zalgo
let Workload_zalgo: Workload! = Workload.zalgo

var Workload_longSharedPrefix: Workload! = Workload.longSharedPrefix
let Workload_longSharedPrefix: Workload! = Workload.longSharedPrefix


@inline(never)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/StringComparison.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public let StringNormalization: [BenchmarkInfo] = [
]

% for Name in AllWorkloads:
var Workload_${Name}: Workload! = Workload.${Name}
let Workload_${Name}: Workload! = Workload.${Name}

% end # AllWorkloads

Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/StringEdits.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public let StringEdits = BenchmarkInfo(
tags: [.validation, .api, .String],
legacyFactor: 100)

var editWords: [String] = [
let editWords: [String] = [
"woodshed",
"lakism",
"gastroperiodynia",
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/StringWalk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ let charactersMultiplier = baseMultiplier / 5

// An extended benchmark suite exercising finer-granularity behavior of our
// Strings.
public var StringWalk = [
public let StringWalk = [
BenchmarkInfo(
name: "StringWalk",
runFunction: run_StringWalk,
Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/StringWalk.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ let charactersMultiplier = baseMultiplier / 5

// An extended benchmark suite exercising finer-granularity behavior of our
// Strings.
public var StringWalk = [
public let StringWalk = [
BenchmarkInfo(
name: "StringWalk",
runFunction: run_StringWalk,
Expand Down
8 changes: 4 additions & 4 deletions benchmark/single-source/Walsh.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func IsPowerOfTwo(_ x: Int) -> Bool { return (x & (x - 1)) == 0 }
func WalshTransform(_ data: inout [Double]) {
assert(IsPowerOfTwo(data.count), "Not a power of two")
var temp = [Double](repeating: 0, count: data.count)
var ret = WalshImpl(&data, &temp, 0, data.count)
let ret = WalshImpl(&data, &temp, 0, data.count)
for i in 0..<data.count {
data[i] = ret[i]
}
Expand Down Expand Up @@ -59,11 +59,11 @@ func WalshImpl(_ data: inout [Double], _ temp: inout [Double], _ start: Int, _ s
}

func checkCorrectness() {
var In : [Double] = [1,0,1,0,0,1,1,0]
var Out : [Double] = [4,2,0,-2,0,2,0,2]
let In : [Double] = [1,0,1,0,0,1,1,0]
let Out : [Double] = [4,2,0,-2,0,2,0,2]
var data : [Double] = In
WalshTransform(&data)
var mid = data
let mid = data
InverseWalshTransform(&data)
for i in 0..<In.count {
// Check encode.
Expand Down