Skip to content

Commit f0c7b64

Browse files
authored
Merge pull request #11304 from eeckstein/fix-bm-warnings
2 parents 14b4dd0 + 9e43229 commit f0c7b64

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

benchmark/single-source/CString.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public func run_StringWithCString(_ N: Int) {
3030

3131
@inline(never)
3232
public func run_CStringLongAscii(_ N: Int) {
33-
let refResult = 517492
3433
var res: UInt = 0
3534
for _ in 1...N*500 {
3635
// static string to c -> from c to String -> implicit conversion
@@ -41,7 +40,6 @@ public func run_CStringLongAscii(_ N: Int) {
4140

4241
@inline(never)
4342
public func run_CStringLongNonAscii(_ N: Int) {
44-
let refResult = 517492
4543
var res: UInt = 0
4644
for _ in 1...N*500 {
4745
res &= strlen(japanese.withCString(String.init(cString:)))

benchmark/single-source/DictionarySwap.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public func run_DictionarySwap(_ N: Int) {
2727

2828
var swapped = false
2929
for _ in 1...10000*N {
30-
swap(&dict[25]!, &dict[75]!)
30+
(dict[25], dict[75]) = (dict[75]!, dict[25]!)
3131
swapped = !swapped
3232
if !swappedCorrectly(swapped, dict[25]!, dict[75]!) {
3333
break
@@ -72,7 +72,9 @@ public func run_DictionarySwapOfObjects(_ N: Int) {
7272

7373
var swapped = false
7474
for _ in 1...10000*N {
75-
swap(&dict[Box(25)]!, &dict[Box(75)]!)
75+
let b1 = Box(25)
76+
let b2 = Box(75)
77+
(dict[b1], dict[b2]) = (dict[b2]!, dict[b1]!)
7678
swapped = !swapped
7779
if !swappedCorrectly(swapped, dict[Box(25)]!.value, dict[Box(75)]!.value) {
7880
break

benchmark/single-source/ExistentialPerformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func runTestArrayShift<T: Existential>(withType: T.Type, numberOfTimes N: Int) {
326326
for _ in 0 ..< N {
327327
for _ in 0 ..< 5_000 {
328328
for i in 0 ..< existentialArray.count-1 {
329-
swap(&existentialArray[i], &existentialArray[i+1])
329+
existentialArray.swapAt(i, i+1)
330330
}
331331
}
332332
}

0 commit comments

Comments
 (0)