Skip to content

Commit

Permalink
Only run benchmarks in Release, they're meaningless in Debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentyrone committed Apr 28, 2023
1 parent 93e5499 commit 0bb0a9a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Tests/RealTests/RelaxedArithmeticTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import _TestSupport
import Accelerate
#endif

#if !DEBUG
func strictSum<T: Real>(_ array: [T]) -> T {
array.reduce(0, +)
}
Expand All @@ -36,11 +37,7 @@ func relaxedSumOfSquares<T: Real>(_ array: [T]) -> T {
// limitations of what XCT measure { } lets us do easily. Good enough for now.
func benchmarkReduction(_ data: [Float], _ reduction: ([Float]) -> Float) {
var accum: Float = 0
#if DEBUG
let iters = 1_000
#else
let iters = 100_000
#endif
for _ in 0 ..< iters {
accum += reduction(data)
}
Expand Down Expand Up @@ -129,3 +126,4 @@ final class RelaxedArithmeticTests: XCTestCase {
#endif
}
}
#endif

0 comments on commit 0bb0a9a

Please sign in to comment.