Skip to content

Commit 086eb07

Browse files
authored
Merge pull request swiftlang#27099 from atrick/fix-rangeiter-bench
Fix RangeIteration and StringWalk benchmarks' use of globals
2 parents 74d47f4 + bbc3ebc commit 086eb07

File tree

3 files changed

+99
-9
lines changed

3 files changed

+99
-9
lines changed

benchmark/single-source/RangeIteration.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public let RangeIteration = [
4040
]
4141
#endif
4242

43-
public var check: UInt64 = 0
44-
4543
@inline(never)
4644
func sum(_ x: UInt64, _ y: UInt64) -> UInt64 {
4745
return x &+ y
@@ -50,7 +48,7 @@ func sum(_ x: UInt64, _ y: UInt64) -> UInt64 {
5048
@inline(never)
5149
public func run_RangeIterationSigned(_ N: Int) {
5250
let range = 0..<100000
53-
check = 0
51+
var check: UInt64 = 0
5452
for _ in 1...N {
5553
for e in range {
5654
check = sum(check, UInt64(e))
@@ -65,7 +63,7 @@ public func run_RangeIterationSigned(_ N: Int) {
6563
@inline(never)
6664
public func run_RangeIterationSigned64(_ N: Int) {
6765
let range: Range<Int64> = 0..<100000
68-
check = 0
66+
var check: UInt64 = 0
6967
for _ in 1...N {
7068
for e in range {
7169
check = sum(check, UInt64(e))
@@ -78,7 +76,7 @@ public func run_RangeIterationSigned64(_ N: Int) {
7876
@inline(never)
7977
public func run_RangeIterationUnsigned(_ N: Int) {
8078
let range: Range<UInt> = 0..<100000
81-
check = 0
79+
var check: UInt64 = 0
8280
for _ in 1...N {
8381
for e in range {
8482
check = sum(check, UInt64(e))

0 commit comments

Comments
 (0)