Skip to content

Commit a4da270

Browse files
author
Dave Abrahams
committed
Remove interpolated strings from benchmark CheckResults
This call was in many cases skewing the benchmark results. Note: Intentionally staging this in without removing the old overload initially.
1 parent 0db10e9 commit a4da270

28 files changed

+79
-74
lines changed

benchmark/single-source/ArrayLiteral.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public func run_ArrayValueProp(_ N: Int) {
4040
res += addLiteralArray()
4141
res -= addLiteralArray()
4242
}
43-
CheckResults(res == 123, "Wrong result in ArrayValueProp 123 != \(res)")
43+
CheckResults(res == 123)
4444
}
4545

4646

@@ -81,7 +81,7 @@ public func run_ArrayValueProp2(_ N: Int) {
8181
res += addLiteralArray2()
8282
res -= addLiteralArray2()
8383
}
84-
CheckResults(res == 123, "Wrong result in ArrayValueProp 123 != \(res)")
84+
CheckResults(res == 123)
8585
}
8686

8787
@inline(never)
@@ -91,7 +91,7 @@ public func run_ArrayValueProp3(_ N: Int) {
9191
res += addLiteralArray3()
9292
res -= addLiteralArray3()
9393
}
94-
CheckResults(res == 123, "Wrong result in ArrayValueProp 123 != \(res)")
94+
CheckResults(res == 123)
9595
}
9696

9797
@inline(never)
@@ -101,5 +101,5 @@ public func run_ArrayValueProp4(_ N: Int) {
101101
res += addLiteralArray4()
102102
res -= addLiteralArray4()
103103
}
104-
CheckResults(res == 123, "Wrong result in ArrayValueProp 123 != \(res)")
104+
CheckResults(res == 123)
105105
}

benchmark/single-source/BitCount.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ func countBitSet(_ num: Int) -> Int {
3333
public func run_BitCount(_ N: Int) {
3434
for _ in 1...100*N {
3535
// Check some results.
36-
CheckResults(countBitSet(1) == 1, "Incorrect results in BitCount.")
37-
CheckResults(countBitSet(2) == 1, "Incorrect results in BitCount.")
38-
CheckResults(countBitSet(2457) == 6, "Incorrect results in BitCount.")
36+
CheckResults(countBitSet(1) == 1)
37+
CheckResults(countBitSet(2) == 1)
38+
CheckResults(countBitSet(2457) == 6)
3939
}
4040
}

benchmark/single-source/ByteSwap.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func byteswap_logn(_ a: UInt64) -> UInt64 {
4242
public func run_ByteSwap(_ N: Int) {
4343
for _ in 1...100*N {
4444
// Check some results.
45-
CheckResults(byteswap_logn(byteswap_n(2457)) == 2457, "Incorrect results in ByteSwap.")
46-
CheckResults(byteswap_logn(byteswap_n(9129)) == 9129, "Incorrect results in ByteSwap.")
47-
CheckResults(byteswap_logn(byteswap_n(3333)) == 3333, "Incorrect results in ByteSwap.")
45+
CheckResults(byteswap_logn(byteswap_n(2457)) == 2457)
46+
CheckResults(byteswap_logn(byteswap_n(9129)) == 9129)
47+
CheckResults(byteswap_logn(byteswap_n(3333)) == 3333)
4848
}
4949
}

benchmark/single-source/CString.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public func run_CStringLongAscii(_ N: Int) {
3636
// static string to c -> from c to String -> implicit conversion
3737
res &= strlen(ascii.withCString(String.init(cString:)))
3838
}
39-
CheckResults(res == 0, "IncorrectResults in run_CStringLongAscii: \(res) != \(refResult)")
39+
CheckResults(res == 0)
4040
}
4141

4242
@inline(never)
@@ -46,7 +46,7 @@ public func run_CStringLongNonAscii(_ N: Int) {
4646
for _ in 1...N*500 {
4747
res &= strlen(japanese.withCString(String.init(cString:)))
4848
}
49-
CheckResults(res == 0, "IncorrectResults in run_CStringLongAscii: \(res) != \(refResult)")
49+
CheckResults(res == 0)
5050
}
5151

5252

benchmark/single-source/Calculator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public func run_Calculator(_ N: Int) {
3636
for _ in 1...N*5000 {
3737
c += my_atoi_impl("10")
3838
}
39-
CheckResults(c == 0, "IncorrectResults in run_Calculator")
39+
CheckResults(c == 0)
4040
}
4141

benchmark/single-source/DeadArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ public func run_DeadArray(_ N: Int) {
3535
Count = 0
3636
runLoop(0, var2: 0)
3737
}
38-
CheckResults(Count == 100_000, "Incorrect number of calls in loop")
38+
CheckResults(Count == 100_000)
3939
}

benchmark/single-source/DictTest2.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public func run_Dictionary2(_ N: Int) {
3434
break
3535
}
3636
}
37-
CheckResults(res == ref_result, "Incorrect results in Dictionary2: \(res) != \(ref_result)")
37+
CheckResults(res == ref_result)
3838
}
3939

4040
class Box<T : Hashable> : Hashable {
@@ -75,5 +75,5 @@ public func run_Dictionary2OfObjects(_ N: Int) {
7575
break
7676
}
7777
}
78-
CheckResults(res == ref_result, "Incorrect results in Dictionary2AllObjects: \(res) != \(ref_result)")
78+
CheckResults(res == ref_result)
7979
}

benchmark/single-source/DictTest3.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public func run_Dictionary3(_ N: Int) {
4141
break
4242
}
4343
}
44-
CheckResults(res == ref_result, "Incorrect results in Dictionary3: \(res) != \(ref_result)")
44+
CheckResults(res == ref_result)
4545
}
4646

4747
class Box<T : Hashable> : Hashable {
@@ -89,5 +89,5 @@ public func run_Dictionary3OfObjects(_ N: Int) {
8989
break
9090
}
9191
}
92-
CheckResults(res == ref_result, "Incorrect results in Dictionary3OfObject: \(res) != \(ref_result)")
92+
CheckResults(res == ref_result)
9393
}

benchmark/single-source/DictionaryBridge.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Thing : NSObject {
2121

2222
required override init() {
2323
let c = type(of: self).col()
24-
CheckResults(c!.count == 10, "The rules of the universe apply")
24+
CheckResults(c!.count == 10)
2525
}
2626

2727
private class func col() -> [String : AnyObject]? {

benchmark/single-source/LazyFilter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public func run_LazilyFilteredRange(_ N: Int) {
2222
res += Array(c).count
2323
res -= Array(c).count
2424
}
25-
CheckResults(res == 123, "Wrong result in LazilyFilteredRange 123 != \(res)")
25+
CheckResults(res == 123)
2626
}
2727

2828
@inline(never)
@@ -33,6 +33,6 @@ public func run_LazilyFilteredArrays(_ N: Int) {
3333
res += Array(c).count
3434
res -= Array(c).count
3535
}
36-
CheckResults(res == 123, "Wrong result in LazilyFilteredArray 123 != \(res)")
36+
CheckResults(res == 123)
3737
}
3838

benchmark/single-source/MapReduce.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public func run_MapReduce(_ N: Int) {
2222
numbers = numbers.map { $0 &+ 5 }
2323
c += numbers.reduce(0, &+)
2424
}
25-
CheckResults(c != 0, "IncorrectResults in MapReduce")
25+
CheckResults(c != 0)
2626
}
2727

2828
@inline(never)
@@ -34,7 +34,7 @@ public func run_MapReduceAnyCollection(_ N: Int) {
3434
let mapped = numbers.map { $0 &+ 5 }
3535
c += mapped.reduce(0, &+)
3636
}
37-
CheckResults(c != 0, "IncorrectResults in MapReduce")
37+
CheckResults(c != 0)
3838
}
3939

4040
@inline(never)
@@ -46,7 +46,7 @@ public func run_MapReduceAnyCollectionShort(_ N: Int) {
4646
let mapped = numbers.map { $0 &+ 5 }
4747
c += mapped.reduce(0, &+)
4848
}
49-
CheckResults(c != 0, "IncorrectResults in MapReduce")
49+
CheckResults(c != 0)
5050
}
5151

5252
@inline(never)
@@ -58,7 +58,7 @@ public func run_MapReduceShort(_ N: Int) {
5858
numbers = numbers.map { $0 &+ 5 }
5959
c += numbers.reduce(0, &+)
6060
}
61-
CheckResults(c != 0, "IncorrectResults in MapReduce")
61+
CheckResults(c != 0)
6262
}
6363

6464
@inline(never)
@@ -70,7 +70,7 @@ public func run_MapReduceSequence(_ N: Int) {
7070
let mapped = numbers.map { $0 &+ 5 }
7171
c += mapped.reduce(0, &+)
7272
}
73-
CheckResults(c != 0, "IncorrectResults in MapReduce")
73+
CheckResults(c != 0)
7474
}
7575

7676
@inline(never)
@@ -82,7 +82,7 @@ public func run_MapReduceLazySequence(_ N: Int) {
8282
let mapped = numbers.lazy.map { $0 &+ 5 }
8383
c += mapped.reduce(0, &+)
8484
}
85-
CheckResults(c != 0, "IncorrectResults in MapReduce")
85+
CheckResults(c != 0)
8686
}
8787

8888
@inline(never)
@@ -94,7 +94,7 @@ public func run_MapReduceLazyCollection(_ N: Int) {
9494
let mapped = numbers.lazy.map { $0 &+ 5 }
9595
c += mapped.reduce(0, &+)
9696
}
97-
CheckResults(c != 0, "IncorrectResults in MapReduce")
97+
CheckResults(c != 0)
9898
}
9999

100100
@inline(never)
@@ -106,7 +106,7 @@ public func run_MapReduceLazyCollectionShort(_ N: Int) {
106106
let mapped = numbers.lazy.map { $0 &+ 5 }
107107
c += mapped.reduce(0, &+)
108108
}
109-
CheckResults(c != 0, "IncorrectResults in MapReduce")
109+
CheckResults(c != 0)
110110
}
111111

112112
@inline(never)
@@ -117,7 +117,7 @@ public func run_MapReduceString(_ N: Int) {
117117
for _ in 1...N*100 {
118118
c += s.utf8.map { UInt64($0 &+ 5) }.reduce(0, &+)
119119
}
120-
CheckResults(c != 0, "IncorrectResults in MapReduce")
120+
CheckResults(c != 0)
121121
}
122122

123123
@inline(never)
@@ -128,7 +128,7 @@ public func run_MapReduceShortString(_ N: Int) {
128128
for _ in 1...N*100 {
129129
c += s.utf8.map { UInt64($0 &+ 5) }.reduce(0, &+)
130130
}
131-
CheckResults(c != 0, "IncorrectResults in MapReduce")
131+
CheckResults(c != 0)
132132
}
133133

134134
@inline(never)
@@ -141,7 +141,7 @@ public func run_MapReduceClass(_ N: Int) {
141141
let mapped = numbers.map { $0.intValue &+ 5 }
142142
c += mapped.reduce(0, &+)
143143
}
144-
CheckResults(c != 0, "IncorrectResults in MapReduce")
144+
CheckResults(c != 0)
145145
#endif
146146
}
147147

@@ -155,7 +155,7 @@ public func run_MapReduceClassShort(_ N: Int) {
155155
let mapped = numbers.map { $0.intValue &+ 5 }
156156
c += mapped.reduce(0, &+)
157157
}
158-
CheckResults(c != 0, "IncorrectResults in MapReduce")
158+
CheckResults(c != 0)
159159
#endif
160160
}
161161

benchmark/single-source/Memset.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ public func run_Memset(_ N: Int) {
2626
memset(&a, 1)
2727
memset(&a, 0)
2828
}
29-
CheckResults(a[87] == 0, "Incorrect result in Memset.")
29+
CheckResults(a[87] == 0)
3030
}

0 commit comments

Comments
 (0)