Skip to content

Commit 20801a0

Browse files
committed
Revert to the original code and exclude it unless objc runtime is available
1 parent 9eeac18 commit 20801a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

benchmark/single-source/MapReduce.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,25 +133,29 @@ public func run_MapReduceShortString(_ N: Int) {
133133

134134
@inline(never)
135135
public func run_MapReduceClass(_ N: Int) {
136-
let numbers = (0..<1000).map { NSDecimalNumber(integerLiteral: $0) }
136+
#if _runtime(_ObjC)
137+
let numbers = (0..<1000).map { NSDecimalNumber(value: $0) }
137138

138139
var c = 0
139140
for _ in 1...N*100 {
140141
let mapped = numbers.map { $0.intValue &+ 5 }
141142
c += mapped.reduce(0, &+)
142143
}
143144
CheckResults(c != 0, "IncorrectResults in MapReduce")
145+
#endif
144146
}
145147

146148
@inline(never)
147149
public func run_MapReduceClassShort(_ N: Int) {
148-
let numbers = (0..<10).map { NSDecimalNumber(integerLiteral: $0) }
150+
#if _runtime(_ObjC)
151+
let numbers = (0..<10).map { NSDecimalNumber(value: $0) }
149152

150153
var c = 0
151154
for _ in 1...N*10000 {
152155
let mapped = numbers.map { $0.intValue &+ 5 }
153156
c += mapped.reduce(0, &+)
154157
}
155158
CheckResults(c != 0, "IncorrectResults in MapReduce")
159+
#endif
156160
}
157161

0 commit comments

Comments
 (0)