Skip to content

Commit 40cce2d

Browse files
authored
Merge pull request #22707 from palimondo/within-one-stem
[benchmark] Move fake autoreleasepool to TestUtils
2 parents fc817ba + 7896909 commit 40cce2d

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

benchmark/single-source/Codable.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,6 @@ public func setup_json() {
107107
JSONTester = CodablePerfTester(encoder: JSONEncoder(), decoder: JSONDecoder())
108108
}
109109

110-
#if !_runtime(_ObjC)
111-
// If we do not have an objc-runtime, then we do not have a definition for
112-
// autoreleasepool. Add in our own fake autoclosure for it that is inline
113-
// always. That should be able to be eaten through by the optimizer no problem.
114-
@inline(__always)
115-
public func autoreleasepool<Result>(
116-
invoking body: () throws -> Result
117-
) rethrows -> Result {
118-
return try body()
119-
}
120-
#endif
121-
122110
@inline(never)
123111
public func run_JSONPerfEncode(_ N: Int) {
124112
autoreleasepool {

benchmark/utils/TestsUtils.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,19 @@ public func CheckResults(
235235
}
236236
}
237237

238+
#if !_runtime(_ObjC)
239+
// If we do not have an objc-runtime, then we do not have a definition for
240+
// autoreleasepool. Add in our own fake autoclosure for it that is inline
241+
// always. That should be able to be eaten through by the optimizer no problem.
242+
@inlinable // FIXME(inline-always)
243+
@inline(__always)
244+
public func autoreleasepool<Result>(
245+
invoking body: () throws -> Result
246+
) rethrows -> Result {
247+
return try body()
248+
}
249+
#endif
250+
238251
public func False() -> Bool { return false }
239252

240253
/// This is a dummy protocol to test the speed of our protocol dispatch.

0 commit comments

Comments
 (0)