diff --git a/Sources/ANKCoreKit/Private/Messages.swift b/Sources/ANKCoreKit/Private/Messages.swift index 28d0d3db..3607faeb 100644 --- a/Sources/ANKCoreKit/Private/Messages.swift +++ b/Sources/ANKCoreKit/Private/Messages.swift @@ -17,15 +17,15 @@ extension ANK { // MARK: Utilities //=------------------------------------------------------------------------= - /// A message describing the source code location of an overflow occurrence. + /// A message describing the source code location of an overflow error. @inlinable public static func callsiteOverflowInfo( function: StaticString = #function, file: StaticString = #file, line: UInt = #line) -> String { "overflow in \(function) at \(file):\(line)" } - /// A message describing the source code location of an index-out-of-bounds occurrence. - @inlinable public static func callsiteIndexOutOfBoundsInfo( + /// A message describing the source code location of an out-of-bounds error. + @inlinable public static func callsiteOutOfBoundsInfo( function: StaticString = #function, file: StaticString = #file, line: UInt = #line) -> String { - "index out of bounds in \(function) at \(file):\(line)" + "out of bounds in \(function) at \(file):\(line)" } } diff --git a/Sources/ANKFullWidthKit/ANKFullWidth+Shifts.swift b/Sources/ANKFullWidthKit/ANKFullWidth+Shifts.swift index 687dcfbf..59aaf155 100644 --- a/Sources/ANKFullWidthKit/ANKFullWidth+Shifts.swift +++ b/Sources/ANKFullWidthKit/ANKFullWidth+Shifts.swift @@ -62,19 +62,19 @@ extension ANKFullWidth { var result = self; result.bitshiftLeftSmart(by: distance); return result } - /// Performs an unchecked left shift. + /// Performs a left shift. /// /// - Parameters: /// - distance: `0 <= distance < Self.bitWidth` /// @inlinable public mutating func bitshiftLeft(by distance: Int) { - precondition(distance >= 0, "shift distance must be at least zero") + precondition(distance >= 0, ANK.callsiteOutOfBoundsInfo()) let major = distance .quotientDividingByBitWidthAssumingIsAtLeastZero() let minor = distance.remainderDividingByBitWidthAssumingIsAtLeastZero() return self.bitshiftLeft(words: major, bits: minor) } - /// Performs an unchecked left shift. + /// Performs a left shift. /// /// - Parameters: /// - distance: `0 <= distance < Self.bitWidth` @@ -83,15 +83,15 @@ extension ANKFullWidth { var result = self; result.bitshiftLeft(by: distance); return result } - /// Performs an unchecked left shift. + /// Performs a left shift. /// /// - Parameters: /// - words: `0 <= words < Self.endIndex` /// - bits: `0 <= bits  < UInt.bitWidth` /// @inlinable public mutating func bitshiftLeft(words: Int, bits: Int) { - precondition(0 ..< self.endIndex ~= words, "invalid major shift distance") - precondition(0 ..< UInt.bitWidth ~= bits, "invalid minor shift distance") + precondition(0 ..< self.endIndex ~= words, ANK.callsiteOutOfBoundsInfo()) + precondition(0 ..< UInt.bitWidth ~= bits, ANK.callsiteOutOfBoundsInfo()) //=--------------------------------------= if bits.isZero { return self.bitshiftLeft(words: words) @@ -113,7 +113,7 @@ extension ANKFullWidth { } } - /// Performs an unchecked left shift. + /// Performs a left shift. /// /// - Parameters: /// - words: `0 <= words < Self.endIndex` @@ -123,13 +123,13 @@ extension ANKFullWidth { var result = self; result.bitshiftLeft(words: words, bits: bits); return result } - /// Performs an unchecked left shift. + /// Performs a left shift. /// /// - Parameters: /// - words: `0 <= words < Self.endIndex` /// @inlinable public mutating func bitshiftLeft(words: Int) { - precondition(0 ..< self.endIndex ~= words, "invalid major shift distance") + precondition(0 ..< self.endIndex ~= words, ANK.callsiteOutOfBoundsInfo()) //=--------------------------------------= if words.isZero { return } //=--------------------------------------= @@ -138,7 +138,7 @@ extension ANKFullWidth { } } - /// Performs an unchecked left shift. + /// Performs a left shift. /// /// - Parameters: /// - words: `0 <= words < Self.endIndex` @@ -201,19 +201,19 @@ extension ANKFullWidth { var result = self; result.bitshiftRightSmart(by: distance); return result } - /// Performs an unchecked, signed, right shift. + /// Performs a signed right shift. /// /// - Parameters: /// - distance: `0 <= distance < Self.bitWidth` /// @inlinable public mutating func bitshiftRight(by distance: Int) { - precondition(distance >= 0, "shift distance must be at least zero") + precondition(distance >= 0, ANK.callsiteOutOfBoundsInfo()) let major = distance .quotientDividingByBitWidthAssumingIsAtLeastZero() let minor = distance.remainderDividingByBitWidthAssumingIsAtLeastZero() return self.bitshiftRight(words: major, bits: minor) } - /// Performs an unchecked, signed, right shift. + /// Performs a signed right shift. /// /// - Parameters: /// - distance: `0 <= distance < Self.bitWidth` @@ -222,15 +222,15 @@ extension ANKFullWidth { var result = self; result.bitshiftRight(by: distance); return result } - /// Performs an unchecked, signed, right shift. + /// Performs a signed right shift. /// /// - Parameters: /// - words: `0 <= words < Self.endIndex` /// - bits: `0 <= bits  < UInt.bitWidth` /// @inlinable public mutating func bitshiftRight(words: Int, bits: Int) { - precondition(0 ..< self.endIndex ~= words, "invalid major shift distance") - precondition(0 ..< UInt.bitWidth ~= bits, "invalid minor shift distance") + precondition(0 ..< self.endIndex ~= words, ANK.callsiteOutOfBoundsInfo()) + precondition(0 ..< UInt.bitWidth ~= bits, ANK.callsiteOutOfBoundsInfo()) //=--------------------------------------= if bits.isZero { return self.bitshiftRight(words: words) @@ -254,7 +254,7 @@ extension ANKFullWidth { } } - /// Performs an unchecked, signed, right shift. + /// Performs a signed right shift. /// /// - Parameters: /// - words: `0 <= words < Self.endIndex` @@ -264,13 +264,13 @@ extension ANKFullWidth { var result = self; result.bitshiftRight(words: words, bits: bits); return result } - /// Performs an unchecked, signed, right shift. + /// Performs a signed right shift. /// /// - Parameters: /// - words: `0 <= words < Self.endIndex` /// @inlinable public mutating func bitshiftRight(words: Int) { - precondition(0 ..< self.endIndex ~= words, "invalid major shift distance") + precondition(0 ..< self.endIndex ~= words, ANK.callsiteOutOfBoundsInfo()) //=--------------------------------------= if words.isZero { return } //=--------------------------------------= @@ -283,7 +283,7 @@ extension ANKFullWidth { } } - /// Performs an unchecked, signed, right shift. + /// Performs a signed right shift. /// /// - Parameters: /// - words: `0 <= words < Self.endIndex` diff --git a/Sources/ANKFullWidthKit/ANKFullWidth+Words+Pointers.swift b/Sources/ANKFullWidthKit/ANKFullWidth+Words+Pointers.swift index 460cb374..9981453d 100644 --- a/Sources/ANKFullWidthKit/ANKFullWidth+Words+Pointers.swift +++ b/Sources/ANKFullWidthKit/ANKFullWidth+Words+Pointers.swift @@ -211,7 +211,7 @@ extension ANKFullWidth { /// Accesses the word at the given index, from least significant to most. @inlinable public subscript(index: Int) -> UInt { - precondition(self.indices ~= index, ANK.callsiteIndexOutOfBoundsInfo()) + precondition(self.indices ~= index, ANK.callsiteOutOfBoundsInfo()) return self[unchecked: index] } @@ -332,12 +332,12 @@ extension ANKFullWidth { /// Accesses the word at the given index, from least significant to most. @inlinable public subscript(index: Int) -> UInt { nonmutating get { - precondition(self.indices ~= index, ANK.callsiteIndexOutOfBoundsInfo()) + precondition(self.indices ~= index, ANK.callsiteOutOfBoundsInfo()) return self[unchecked: index] } nonmutating set { - precondition(self.indices ~= index, ANK.callsiteIndexOutOfBoundsInfo()) + precondition(self.indices ~= index, ANK.callsiteOutOfBoundsInfo()) self[unchecked: index] = newValue } } diff --git a/Sources/ANKFullWidthKit/ANKFullWidth+Words.swift b/Sources/ANKFullWidthKit/ANKFullWidth+Words.swift index dbeccce9..25c5197a 100644 --- a/Sources/ANKFullWidthKit/ANKFullWidth+Words.swift +++ b/Sources/ANKFullWidthKit/ANKFullWidth+Words.swift @@ -228,7 +228,7 @@ extension ANKFullWidth where High == High.Magnitude { //=------------------------------------------------------------------------= @inlinable static func endiannessSensitiveIndex(unchecked index: Int) -> Int { - assert(self.indices ~= index, ANK.callsiteIndexOutOfBoundsInfo()) + assert(self.indices ~= index, ANK.callsiteOutOfBoundsInfo()) #if _endian(big) return self.lastIndex - index #else diff --git a/Tests/ANKCoreKitBenchmarks/Int+Division.swift b/Tests/ANKCoreKitBenchmarks/Int+Division.swift new file mode 100644 index 00000000..9e461892 --- /dev/null +++ b/Tests/ANKCoreKitBenchmarks/Int+Division.swift @@ -0,0 +1,161 @@ +//=----------------------------------------------------------------------------= +// This source file is part of the AwesomeNumbersKit open source project. +// +// Copyright (c) 2022 Oscar Byström Ericsson +// Licensed under Apache License, Version 2.0 +// +// See http://www.apache.org/licenses/LICENSE-2.0 for license information. +//=----------------------------------------------------------------------------= + +#if !DEBUG + +import ANKCoreKit +import XCTest + +//*============================================================================* +// MARK: * ANK x Int x Division +//*============================================================================* + +final class IntBenchmarksOnDivision: XCTestCase { + + typealias T = Int + typealias M = UInt + + //=------------------------------------------------------------------------= + // MARK: Tests + //=------------------------------------------------------------------------= + + func testQuotientAndRemainder() { + var lhs = ANK.blackHoleIdentity(~T(123)) + var rhs = ANK.blackHoleIdentity( T(123)) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.quotientAndRemainder(dividingBy: rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } + + func testQuotientReportingOverflow() { + var lhs = ANK.blackHoleIdentity(~T(123)) + var rhs = ANK.blackHoleIdentity( T(123)) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.dividedReportingOverflow(by: rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } + + func testRemainderReportingOverflow() { + var lhs = ANK.blackHoleIdentity(~T(123)) + var rhs = ANK.blackHoleIdentity( T(123)) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.remainderReportingOverflow(dividingBy: rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } + + //=------------------------------------------------------------------------= + // MARK: Tests x Full Width + //=------------------------------------------------------------------------= + + func testDividingFullWidth() { + var lhs = ANK.blackHoleIdentity((T.max)) + var rhs = ANK.blackHoleIdentity((T.max / 2, M(bitPattern: T.max))) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.dividingFullWidth(rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } + + func testDividingFullWidthReportingOverflow() { + var lhs = ANK.blackHoleIdentity((T.max)) + var rhs = ANK.blackHoleIdentity((T.max / 2, M(bitPattern: T.max))) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.dividingFullWidthReportingOverflow(rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } +} + +//*============================================================================* +// MARK: * ANK x UInt x Division +//*============================================================================* + +final class UIntBenchmarksOnDivision: XCTestCase { + + typealias T = UInt + typealias M = UInt + + //=------------------------------------------------------------------------= + // MARK: Tests + //=------------------------------------------------------------------------= + + func testQuotientAndRemainder() { + var lhs = ANK.blackHoleIdentity(~T(123)) + var rhs = ANK.blackHoleIdentity( T(123)) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.quotientAndRemainder(dividingBy: rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } + + func testQuotientReportingOverflow() { + var lhs = ANK.blackHoleIdentity(~T(123)) + var rhs = ANK.blackHoleIdentity( T(123)) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.dividedReportingOverflow(by: rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } + + func testRemainderReportingOverflow() { + var lhs = ANK.blackHoleIdentity(~T(123)) + var rhs = ANK.blackHoleIdentity( T(123)) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.remainderReportingOverflow(dividingBy: rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } + + //=------------------------------------------------------------------------= + // MARK: Tests x Full Width + //=------------------------------------------------------------------------= + + func testDividingFullWidth() { + var lhs = ANK.blackHoleIdentity((T.max)) + var rhs = ANK.blackHoleIdentity((T.max - 1, M.max)) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.dividingFullWidth(rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } + + func testDividingFullWidthReportingOverflow() { + var lhs = ANK.blackHoleIdentity((T.max)) + var rhs = ANK.blackHoleIdentity((T.max - 1, M.max)) + + for _ in 0 ..< 5_000_000 { + ANK.blackHole(lhs.dividingFullWidthReportingOverflow(rhs)) + ANK.blackHoleInoutIdentity(&lhs) + ANK.blackHoleInoutIdentity(&rhs) + } + } +} + +#endif diff --git a/Tests/ANKCoreKitBenchmarks/Swift+FloatingPointSign.swift b/Tests/ANKCoreKitBenchmarks/Swift+FloatingPointSign.swift index cc2ce819..65246224 100644 --- a/Tests/ANKCoreKitBenchmarks/Swift+FloatingPointSign.swift +++ b/Tests/ANKCoreKitBenchmarks/Swift+FloatingPointSign.swift @@ -28,7 +28,7 @@ final class ANKSwiftBenchmarksOnFloatingPointSign: XCTestCase { var abc = ANK.blackHoleIdentity(true ) var xyz = ANK.blackHoleIdentity(false) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(abc)) ANK.blackHole(T(xyz)) @@ -45,7 +45,7 @@ final class ANKSwiftBenchmarksOnFloatingPointSign: XCTestCase { var abc = ANK.blackHoleIdentity(T.plus ) var xyz = ANK.blackHoleIdentity(T.minus) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bit) ANK.blackHole(xyz.bit) @@ -62,7 +62,7 @@ final class ANKSwiftBenchmarksOnFloatingPointSign: XCTestCase { var abc = ANK.blackHoleIdentity(T.plus ) var xyz = ANK.blackHoleIdentity(T.minus) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(~abc) ANK.blackHole(~xyz) @@ -75,7 +75,7 @@ final class ANKSwiftBenchmarksOnFloatingPointSign: XCTestCase { var lhs = ANK.blackHoleIdentity(T.plus ) var rhs = ANK.blackHoleIdentity(T.minus) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs & rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -86,7 +86,7 @@ final class ANKSwiftBenchmarksOnFloatingPointSign: XCTestCase { var lhs = ANK.blackHoleIdentity(T.plus ) var rhs = ANK.blackHoleIdentity(T.minus) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs | rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -97,7 +97,7 @@ final class ANKSwiftBenchmarksOnFloatingPointSign: XCTestCase { var lhs = ANK.blackHoleIdentity(T.plus ) var rhs = ANK.blackHoleIdentity(T.minus) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs ^ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) diff --git a/Tests/ANKFullWidthKitBenchmarks/192+Addition.swift b/Tests/ANKFullWidthKitBenchmarks/192+Addition.swift index b77a11a3..1d6641fe 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192+Addition.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192+Addition.swift @@ -32,7 +32,7 @@ final class Int192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -69,7 +69,7 @@ final class Int192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -80,7 +80,7 @@ final class Int192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -91,7 +91,7 @@ final class Int192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -115,7 +115,7 @@ final class UInt192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -126,7 +126,7 @@ final class UInt192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -137,7 +137,7 @@ final class UInt192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -152,7 +152,7 @@ final class UInt192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -163,7 +163,7 @@ final class UInt192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -174,7 +174,7 @@ final class UInt192BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) diff --git a/Tests/ANKFullWidthKitBenchmarks/192+Bits.swift b/Tests/ANKFullWidthKitBenchmarks/192+Bits.swift index 9368aa2b..2b263898 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192+Bits.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192+Bits.swift @@ -32,7 +32,7 @@ final class Int192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity(true ) var xyz = ANK.blackHoleIdentity(false) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(bit: abc)) ANK.blackHole(T(bit: xyz)) @@ -45,7 +45,7 @@ final class Int192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity(true ) var xyz = ANK.blackHoleIdentity(false) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(repeating: abc)) ANK.blackHole(T(repeating: xyz)) @@ -62,7 +62,7 @@ final class Int192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bitWidth) ANK.blackHole(xyz.bitWidth) @@ -75,7 +75,7 @@ final class Int192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.nonzeroBitCount) ANK.blackHole(xyz.nonzeroBitCount) @@ -88,7 +88,7 @@ final class Int192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.leadingZeroBitCount) ANK.blackHole(xyz.leadingZeroBitCount) @@ -101,7 +101,7 @@ final class Int192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.trailingZeroBitCount) ANK.blackHole(xyz.trailingZeroBitCount) @@ -114,7 +114,7 @@ final class Int192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.mostSignificantBit) ANK.blackHole(xyz.mostSignificantBit) @@ -127,7 +127,7 @@ final class Int192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.leastSignificantBit) ANK.blackHole(xyz.leastSignificantBit) @@ -153,7 +153,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bitPattern) ANK.blackHole(xyz.bitPattern) @@ -166,7 +166,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(bitPattern: abc)) ANK.blackHole(T(bitPattern: xyz)) @@ -179,7 +179,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity(true ) var xyz = ANK.blackHoleIdentity(false) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(bit: abc)) ANK.blackHole(T(bit: xyz)) @@ -192,7 +192,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity(true ) var xyz = ANK.blackHoleIdentity(false) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(repeating: abc)) ANK.blackHole(T(repeating: xyz)) @@ -209,7 +209,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bitWidth) ANK.blackHole(xyz.bitWidth) @@ -222,7 +222,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.nonzeroBitCount) ANK.blackHole(xyz.nonzeroBitCount) @@ -235,7 +235,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.leadingZeroBitCount) ANK.blackHole(xyz.leadingZeroBitCount) @@ -248,7 +248,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.trailingZeroBitCount) ANK.blackHole(xyz.trailingZeroBitCount) @@ -261,7 +261,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.mostSignificantBit) ANK.blackHole(xyz.mostSignificantBit) @@ -274,7 +274,7 @@ final class UInt192BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.leastSignificantBit) ANK.blackHole(xyz.leastSignificantBit) diff --git a/Tests/ANKFullWidthKitBenchmarks/192+Comparisons.swift b/Tests/ANKFullWidthKitBenchmarks/192+Comparisons.swift index bec6fc0c..618b30a2 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192+Comparisons.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192+Comparisons.swift @@ -32,7 +32,7 @@ final class Int192BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs == rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int192BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs < rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int192BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.compared(to: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -68,7 +68,7 @@ final class Int192BenchmarksOnComparisons: XCTestCase { func testIsZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isZero) ANK.blackHoleInoutIdentity(&abc) } @@ -77,7 +77,7 @@ final class Int192BenchmarksOnComparisons: XCTestCase { func testIsLessThanZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isLessThanZero) ANK.blackHoleInoutIdentity(&abc) } @@ -86,7 +86,7 @@ final class Int192BenchmarksOnComparisons: XCTestCase { func testIsMoreThanZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isMoreThanZero) ANK.blackHoleInoutIdentity(&abc) } @@ -95,7 +95,7 @@ final class Int192BenchmarksOnComparisons: XCTestCase { func testIsPowerOf2() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isPowerOf2) ANK.blackHoleInoutIdentity(&abc) } @@ -118,7 +118,7 @@ final class UInt192BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs == rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -129,7 +129,7 @@ final class UInt192BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs < rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -140,7 +140,7 @@ final class UInt192BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.compared(to: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -154,7 +154,7 @@ final class UInt192BenchmarksOnComparisons: XCTestCase { func testIsZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isZero) ANK.blackHoleInoutIdentity(&abc) } @@ -163,7 +163,7 @@ final class UInt192BenchmarksOnComparisons: XCTestCase { func testIsLessThanZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isLessThanZero) ANK.blackHoleInoutIdentity(&abc) } @@ -172,7 +172,7 @@ final class UInt192BenchmarksOnComparisons: XCTestCase { func testIsMoreThanZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isMoreThanZero) ANK.blackHoleInoutIdentity(&abc) } @@ -181,7 +181,7 @@ final class UInt192BenchmarksOnComparisons: XCTestCase { func testIsPowerOf2() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isPowerOf2) ANK.blackHoleInoutIdentity(&abc) } diff --git a/Tests/ANKFullWidthKitBenchmarks/192+Complements.swift b/Tests/ANKFullWidthKitBenchmarks/192+Complements.swift index 7e354ce5..73234388 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192+Complements.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192+Complements.swift @@ -33,7 +33,7 @@ final class Int192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bitPattern) ANK.blackHole(xyz.bitPattern) @@ -46,7 +46,7 @@ final class Int192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(bitPattern: abc)) ANK.blackHole(T(bitPattern: xyz)) @@ -63,7 +63,7 @@ final class Int192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.magnitude) ANK.blackHole(xyz.magnitude) @@ -80,7 +80,7 @@ final class Int192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.twosComplement()) ANK.blackHole(xyz.twosComplement()) @@ -93,7 +93,7 @@ final class Int192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.twosComplementSubsequence(true)) ANK.blackHole(xyz.twosComplementSubsequence(true)) @@ -120,7 +120,7 @@ final class UInt192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bitPattern) ANK.blackHole(xyz.bitPattern) @@ -133,7 +133,7 @@ final class UInt192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(bitPattern: abc)) ANK.blackHole(T(bitPattern: xyz)) @@ -150,7 +150,7 @@ final class UInt192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.magnitude) ANK.blackHole(xyz.magnitude) @@ -167,7 +167,7 @@ final class UInt192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.twosComplement()) ANK.blackHole(xyz.twosComplement()) @@ -180,7 +180,7 @@ final class UInt192BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.twosComplementSubsequence(true)) ANK.blackHole(xyz.twosComplementSubsequence(true)) diff --git a/Tests/ANKFullWidthKitBenchmarks/192+Endianness.swift b/Tests/ANKFullWidthKitBenchmarks/192+Endianness.swift index b6603955..77e48fe5 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192+Endianness.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192+Endianness.swift @@ -31,7 +31,7 @@ final class Int192BenchmarksOnEndianness: XCTestCase { func testBigEndian() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bigEndian) ANK.blackHoleInoutIdentity(&abc) } @@ -40,7 +40,7 @@ final class Int192BenchmarksOnEndianness: XCTestCase { func testLittleEndian() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.littleEndian) ANK.blackHoleInoutIdentity(&abc) } @@ -49,7 +49,7 @@ final class Int192BenchmarksOnEndianness: XCTestCase { func testByteSwapped() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.byteSwapped) ANK.blackHoleInoutIdentity(&abc) } @@ -71,7 +71,7 @@ final class UInt192BenchmarksOnEndianness: XCTestCase { func testBigEndian() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bigEndian) ANK.blackHoleInoutIdentity(&abc) } @@ -80,7 +80,7 @@ final class UInt192BenchmarksOnEndianness: XCTestCase { func testLittleEndian() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.littleEndian) ANK.blackHoleInoutIdentity(&abc) } @@ -89,7 +89,7 @@ final class UInt192BenchmarksOnEndianness: XCTestCase { func testByteSwapped() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.byteSwapped) ANK.blackHoleInoutIdentity(&abc) } diff --git a/Tests/ANKFullWidthKitBenchmarks/192+Logic.swift b/Tests/ANKFullWidthKitBenchmarks/192+Logic.swift index ca458760..d0751926 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192+Logic.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192+Logic.swift @@ -32,7 +32,7 @@ final class Int192BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs & rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int192BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs | rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int192BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs ^ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -64,7 +64,7 @@ final class Int192BenchmarksOnLogic: XCTestCase { func testNot() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(~abc) ANK.blackHoleInoutIdentity(&abc) } @@ -87,7 +87,7 @@ final class UInt192BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs & rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -98,7 +98,7 @@ final class UInt192BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs | rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -109,7 +109,7 @@ final class UInt192BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs ^ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -119,7 +119,7 @@ final class UInt192BenchmarksOnLogic: XCTestCase { func testNot() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(~abc) ANK.blackHoleInoutIdentity(&abc) } diff --git a/Tests/ANKFullWidthKitBenchmarks/192+Multiplication.swift b/Tests/ANKFullWidthKitBenchmarks/192+Multiplication.swift index ea65f64c..08f38728 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192+Multiplication.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192+Multiplication.swift @@ -32,7 +32,7 @@ final class Int192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(-T(x64: X(3, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3))) var rhs = ANK.blackHoleIdentity(-T(x64: X(3, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(-T(x64: X(3, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -65,7 +65,7 @@ final class Int192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(-T(x64: X(3, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -80,7 +80,7 @@ final class Int192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(-Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -91,7 +91,7 @@ final class Int192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3))) var rhs = ANK.blackHoleIdentity(-Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -102,7 +102,7 @@ final class Int192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(-Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -113,7 +113,7 @@ final class Int192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(-Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -137,7 +137,7 @@ final class UInt192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(T(x64: X(3, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -148,7 +148,7 @@ final class UInt192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3))) var rhs = ANK.blackHoleIdentity(T(x64: X(3, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -159,7 +159,7 @@ final class UInt192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(T(x64: X(3, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -170,7 +170,7 @@ final class UInt192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(T(x64: X(3, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -185,7 +185,7 @@ final class UInt192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -196,7 +196,7 @@ final class UInt192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -207,7 +207,7 @@ final class UInt192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -218,7 +218,7 @@ final class UInt192BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 0))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) diff --git a/Tests/ANKFullWidthKitBenchmarks/192+Negation.swift b/Tests/ANKFullWidthKitBenchmarks/192+Negation.swift index 914c77b2..795fd577 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192+Negation.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192+Negation.swift @@ -31,7 +31,7 @@ final class Int192BenchmarksOnNegation: XCTestCase { func testNegated() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(-abc) ANK.blackHoleInoutIdentity(&abc) } @@ -40,7 +40,7 @@ final class Int192BenchmarksOnNegation: XCTestCase { func testNegatedReportingOverflow() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.negatedReportingOverflow()) ANK.blackHoleInoutIdentity(&abc) } diff --git a/Tests/ANKFullWidthKitBenchmarks/192+Subtraction.swift b/Tests/ANKFullWidthKitBenchmarks/192+Subtraction.swift index 6d472711..43db0303 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192+Subtraction.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192+Subtraction.swift @@ -32,7 +32,7 @@ final class Int192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -69,7 +69,7 @@ final class Int192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -80,7 +80,7 @@ final class Int192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -91,7 +91,7 @@ final class Int192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -115,7 +115,7 @@ final class UInt192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -126,7 +126,7 @@ final class UInt192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -137,7 +137,7 @@ final class UInt192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -152,7 +152,7 @@ final class UInt192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -163,7 +163,7 @@ final class UInt192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -174,7 +174,7 @@ final class UInt192BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) diff --git a/Tests/ANKFullWidthKitBenchmarks/192.swift b/Tests/ANKFullWidthKitBenchmarks/192.swift index 5e8cea43..8aaa5d03 100644 --- a/Tests/ANKFullWidthKitBenchmarks/192.swift +++ b/Tests/ANKFullWidthKitBenchmarks/192.swift @@ -33,7 +33,7 @@ final class Int192Benchmarks: XCTestCase { var abc = ANK.blackHoleIdentity(LH( T.Low .zero, T.High.zero )) var xyz = ANK.blackHoleIdentity(HL( T.High.zero, T.Low .zero )) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(ascending: abc)) ANK.blackHole(T(descending: xyz)) @@ -60,7 +60,7 @@ final class UInt192Benchmarks: XCTestCase { var abc = ANK.blackHoleIdentity(LH( T.Low .zero, T.High.zero )) var xyz = ANK.blackHoleIdentity(HL( T.High.zero, T.Low .zero )) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(ascending: abc)) ANK.blackHole(T(descending: xyz)) diff --git a/Tests/ANKFullWidthKitBenchmarks/256+Addition.swift b/Tests/ANKFullWidthKitBenchmarks/256+Addition.swift index f23c50c0..8bc2b1b7 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256+Addition.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256+Addition.swift @@ -32,7 +32,7 @@ final class Int256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -69,7 +69,7 @@ final class Int256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -80,7 +80,7 @@ final class Int256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -91,7 +91,7 @@ final class Int256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -115,7 +115,7 @@ final class UInt256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -126,7 +126,7 @@ final class UInt256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -137,7 +137,7 @@ final class UInt256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -152,7 +152,7 @@ final class UInt256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -163,7 +163,7 @@ final class UInt256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -174,7 +174,7 @@ final class UInt256BenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) diff --git a/Tests/ANKFullWidthKitBenchmarks/256+Bits.swift b/Tests/ANKFullWidthKitBenchmarks/256+Bits.swift index f15ad2df..c4884d92 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256+Bits.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256+Bits.swift @@ -32,7 +32,7 @@ final class Int256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity(true ) var xyz = ANK.blackHoleIdentity(false) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(bit: abc)) ANK.blackHole(T(bit: xyz)) @@ -45,7 +45,7 @@ final class Int256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity(true ) var xyz = ANK.blackHoleIdentity(false) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(repeating: abc)) ANK.blackHole(T(repeating: xyz)) @@ -62,7 +62,7 @@ final class Int256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bitWidth) ANK.blackHole(xyz.bitWidth) @@ -75,7 +75,7 @@ final class Int256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.nonzeroBitCount) ANK.blackHole(xyz.nonzeroBitCount) @@ -88,7 +88,7 @@ final class Int256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.leadingZeroBitCount) ANK.blackHole(xyz.leadingZeroBitCount) @@ -101,7 +101,7 @@ final class Int256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.trailingZeroBitCount) ANK.blackHole(xyz.trailingZeroBitCount) @@ -114,7 +114,7 @@ final class Int256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.mostSignificantBit) ANK.blackHole(xyz.mostSignificantBit) @@ -127,7 +127,7 @@ final class Int256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.leastSignificantBit) ANK.blackHole(xyz.leastSignificantBit) @@ -153,7 +153,7 @@ final class UInt256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity(true ) var xyz = ANK.blackHoleIdentity(false) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(bit: abc)) ANK.blackHole(T(bit: xyz)) @@ -166,7 +166,7 @@ final class UInt256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity(true ) var xyz = ANK.blackHoleIdentity(false) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(repeating: abc)) ANK.blackHole(T(repeating: xyz)) @@ -183,7 +183,7 @@ final class UInt256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bitWidth) ANK.blackHole(xyz.bitWidth) @@ -196,7 +196,7 @@ final class UInt256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.nonzeroBitCount) ANK.blackHole(xyz.nonzeroBitCount) @@ -209,7 +209,7 @@ final class UInt256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.leadingZeroBitCount) ANK.blackHole(xyz.leadingZeroBitCount) @@ -222,7 +222,7 @@ final class UInt256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.trailingZeroBitCount) ANK.blackHole(xyz.trailingZeroBitCount) @@ -235,7 +235,7 @@ final class UInt256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.mostSignificantBit) ANK.blackHole(xyz.mostSignificantBit) @@ -248,7 +248,7 @@ final class UInt256BenchmarksOnBits: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.leastSignificantBit) ANK.blackHole(xyz.leastSignificantBit) diff --git a/Tests/ANKFullWidthKitBenchmarks/256+Comparisons.swift b/Tests/ANKFullWidthKitBenchmarks/256+Comparisons.swift index ea973bbb..c411bfb6 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256+Comparisons.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256+Comparisons.swift @@ -32,7 +32,7 @@ final class Int256BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs == rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int256BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs < rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int256BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.compared(to: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -68,7 +68,7 @@ final class Int256BenchmarksOnComparisons: XCTestCase { func testIsZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isZero) ANK.blackHoleInoutIdentity(&abc) } @@ -77,7 +77,7 @@ final class Int256BenchmarksOnComparisons: XCTestCase { func testIsLessThanZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isLessThanZero) ANK.blackHoleInoutIdentity(&abc) } @@ -86,7 +86,7 @@ final class Int256BenchmarksOnComparisons: XCTestCase { func testIsMoreThanZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isMoreThanZero) ANK.blackHoleInoutIdentity(&abc) } @@ -95,7 +95,7 @@ final class Int256BenchmarksOnComparisons: XCTestCase { func testIsPowerOf2() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isPowerOf2) ANK.blackHoleInoutIdentity(&abc) } @@ -118,7 +118,7 @@ final class UInt256BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs == rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -129,7 +129,7 @@ final class UInt256BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs < rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -140,7 +140,7 @@ final class UInt256BenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) var rhs = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.compared(to: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -154,7 +154,7 @@ final class UInt256BenchmarksOnComparisons: XCTestCase { func testIsZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isZero) ANK.blackHoleInoutIdentity(&abc) } @@ -163,7 +163,7 @@ final class UInt256BenchmarksOnComparisons: XCTestCase { func testIsLessThanZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isLessThanZero) ANK.blackHoleInoutIdentity(&abc) } @@ -172,7 +172,7 @@ final class UInt256BenchmarksOnComparisons: XCTestCase { func testIsMoreThanZero() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isMoreThanZero) ANK.blackHoleInoutIdentity(&abc) } @@ -181,7 +181,7 @@ final class UInt256BenchmarksOnComparisons: XCTestCase { func testIsPowerOf2() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isPowerOf2) ANK.blackHoleInoutIdentity(&abc) } diff --git a/Tests/ANKFullWidthKitBenchmarks/256+Complements.swift b/Tests/ANKFullWidthKitBenchmarks/256+Complements.swift index f3bfb6f8..11449eda 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256+Complements.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256+Complements.swift @@ -33,7 +33,7 @@ final class Int256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bitPattern) ANK.blackHole(xyz.bitPattern) @@ -46,7 +46,7 @@ final class Int256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(bitPattern: abc)) ANK.blackHole(T(bitPattern: xyz)) @@ -63,7 +63,7 @@ final class Int256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.magnitude) ANK.blackHole(xyz.magnitude) @@ -80,7 +80,7 @@ final class Int256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.twosComplement()) ANK.blackHole(xyz.twosComplement()) @@ -93,7 +93,7 @@ final class Int256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.twosComplementSubsequence(true)) ANK.blackHole(xyz.twosComplementSubsequence(true)) @@ -120,7 +120,7 @@ final class UInt256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bitPattern) ANK.blackHole(xyz.bitPattern) @@ -133,7 +133,7 @@ final class UInt256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(bitPattern: abc)) ANK.blackHole(T(bitPattern: xyz)) @@ -150,7 +150,7 @@ final class UInt256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.magnitude) ANK.blackHole(xyz.magnitude) @@ -167,7 +167,7 @@ final class UInt256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.twosComplement()) ANK.blackHole(xyz.twosComplement()) @@ -180,7 +180,7 @@ final class UInt256BenchmarksOnComplements: XCTestCase { var abc = ANK.blackHoleIdentity( T(x64: X(0, 0, 0, 0))) var xyz = ANK.blackHoleIdentity(~T(x64: X(0, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.twosComplementSubsequence(true)) ANK.blackHole(xyz.twosComplementSubsequence(true)) diff --git a/Tests/ANKFullWidthKitBenchmarks/256+Endianness.swift b/Tests/ANKFullWidthKitBenchmarks/256+Endianness.swift index 4ab08008..6d4440f2 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256+Endianness.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256+Endianness.swift @@ -31,7 +31,7 @@ final class Int256BenchmarksOnEndianness: XCTestCase { func testBigEndian() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bigEndian) ANK.blackHoleInoutIdentity(&abc) } @@ -40,7 +40,7 @@ final class Int256BenchmarksOnEndianness: XCTestCase { func testLittleEndian() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.littleEndian) ANK.blackHoleInoutIdentity(&abc) } @@ -49,7 +49,7 @@ final class Int256BenchmarksOnEndianness: XCTestCase { func testByteSwapped() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.byteSwapped) ANK.blackHoleInoutIdentity(&abc) } @@ -71,7 +71,7 @@ final class UInt256BenchmarksOnEndianness: XCTestCase { func testBigEndian() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.bigEndian) ANK.blackHoleInoutIdentity(&abc) } @@ -80,7 +80,7 @@ final class UInt256BenchmarksOnEndianness: XCTestCase { func testLittleEndian() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.littleEndian) ANK.blackHoleInoutIdentity(&abc) } @@ -89,7 +89,7 @@ final class UInt256BenchmarksOnEndianness: XCTestCase { func testByteSwapped() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.byteSwapped) ANK.blackHoleInoutIdentity(&abc) } diff --git a/Tests/ANKFullWidthKitBenchmarks/256+Logic.swift b/Tests/ANKFullWidthKitBenchmarks/256+Logic.swift index c5330f76..ef64f3bd 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256+Logic.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256+Logic.swift @@ -32,7 +32,7 @@ final class Int256BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs & rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int256BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs | rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int256BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs ^ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -64,7 +64,7 @@ final class Int256BenchmarksOnLogic: XCTestCase { func testNot() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(~abc) ANK.blackHoleInoutIdentity(&abc) } @@ -87,7 +87,7 @@ final class UInt256BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs & rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -98,7 +98,7 @@ final class UInt256BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs | rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -109,7 +109,7 @@ final class UInt256BenchmarksOnLogic: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs ^ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -119,7 +119,7 @@ final class UInt256BenchmarksOnLogic: XCTestCase { func testNot() { var abc = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(~abc) ANK.blackHoleInoutIdentity(&abc) } diff --git a/Tests/ANKFullWidthKitBenchmarks/256+Multiplication.swift b/Tests/ANKFullWidthKitBenchmarks/256+Multiplication.swift index 3d05216c..1497533c 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256+Multiplication.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256+Multiplication.swift @@ -32,7 +32,7 @@ final class Int256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(-T(x64: X(3, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(-T(x64: X(3, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(-T(x64: X(3, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -65,7 +65,7 @@ final class Int256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(-T(x64: X(3, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -80,7 +80,7 @@ final class Int256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(-Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -91,7 +91,7 @@ final class Int256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(-Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -102,7 +102,7 @@ final class Int256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(-Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -113,7 +113,7 @@ final class Int256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity( T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(-Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -137,7 +137,7 @@ final class UInt256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(T(x64: X(3, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -148,7 +148,7 @@ final class UInt256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(T(x64: X(3, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -159,7 +159,7 @@ final class UInt256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(T(x64: X(3, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -170,7 +170,7 @@ final class UInt256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(T(x64: X(3, 0, 0, 0))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -185,7 +185,7 @@ final class UInt256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -196,7 +196,7 @@ final class UInt256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -207,7 +207,7 @@ final class UInt256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -218,7 +218,7 @@ final class UInt256BenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(3, 3, 3, 0))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) diff --git a/Tests/ANKFullWidthKitBenchmarks/256+Negation.swift b/Tests/ANKFullWidthKitBenchmarks/256+Negation.swift index f74e33d1..c56791da 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256+Negation.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256+Negation.swift @@ -31,7 +31,7 @@ final class Int256BenchmarksOnNegation: XCTestCase { func testNegated() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(-abc) ANK.blackHoleInoutIdentity(&abc) } @@ -40,7 +40,7 @@ final class Int256BenchmarksOnNegation: XCTestCase { func testNegatedReportingOverflow() { var abc = ANK.blackHoleIdentity(T(x64: X(0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.negatedReportingOverflow()) ANK.blackHoleInoutIdentity(&abc) } diff --git a/Tests/ANKFullWidthKitBenchmarks/256+Subtraction.swift b/Tests/ANKFullWidthKitBenchmarks/256+Subtraction.swift index 9a6f5084..20cd1ef4 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256+Subtraction.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256+Subtraction.swift @@ -32,7 +32,7 @@ final class Int256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -43,7 +43,7 @@ final class Int256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -54,7 +54,7 @@ final class Int256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -69,7 +69,7 @@ final class Int256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -80,7 +80,7 @@ final class Int256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -91,7 +91,7 @@ final class Int256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(Int.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -115,7 +115,7 @@ final class UInt256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -126,7 +126,7 @@ final class UInt256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -137,7 +137,7 @@ final class UInt256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(T(x64: X( 0, 1, 2, 3))) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -152,7 +152,7 @@ final class UInt256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -163,7 +163,7 @@ final class UInt256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -174,7 +174,7 @@ final class UInt256BenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T(x64: X(~0, ~1, ~2, ~3))) var rhs = ANK.blackHoleIdentity(UInt.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) diff --git a/Tests/ANKFullWidthKitBenchmarks/256.swift b/Tests/ANKFullWidthKitBenchmarks/256.swift index 9ce38cd2..7f250f6a 100644 --- a/Tests/ANKFullWidthKitBenchmarks/256.swift +++ b/Tests/ANKFullWidthKitBenchmarks/256.swift @@ -33,7 +33,7 @@ final class Int256Benchmarks: XCTestCase { var abc = ANK.blackHoleIdentity(LH( T.Low .zero, T.High.zero )) var xyz = ANK.blackHoleIdentity(HL( T.High.zero, T.Low .zero )) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(ascending: abc)) ANK.blackHole(T(descending: xyz)) @@ -60,7 +60,7 @@ final class UInt256Benchmarks: XCTestCase { var abc = ANK.blackHoleIdentity(LH( T.Low .zero, T.High.zero )) var xyz = ANK.blackHoleIdentity(HL( T.High.zero, T.Low .zero )) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(T(ascending: abc)) ANK.blackHole(T(descending: xyz)) diff --git a/Tests/ANKFullWidthKitTests/ANKFullWidth.swift b/Tests/ANKFullWidthKitTests/ANKFullWidth.swift index d1fa5c81..9ca8a3f4 100644 --- a/Tests/ANKFullWidthKitTests/ANKFullWidth.swift +++ b/Tests/ANKFullWidthKitTests/ANKFullWidth.swift @@ -43,6 +43,7 @@ final class ANKFullWidthTests: XCTestCase { XCTAssert(MemoryLayout.size == MemoryLayout.stride) XCTAssert(MemoryLayout.size / MemoryLayout.stride >= 2) XCTAssert(MemoryLayout.size % MemoryLayout.stride == 0) + XCTAssert(MemoryLayout.alignment == MemoryLayout.alignment) } for type: T in types { diff --git a/Tests/ANKFullWidthKitTests/Utilities/ANKAssert+Shifts.swift b/Tests/ANKFullWidthKitTests/Utilities/ANKAssert+Shifts.swift index 6f6c96e2..fe9bbc0b 100644 --- a/Tests/ANKFullWidthKitTests/Utilities/ANKAssert+Shifts.swift +++ b/Tests/ANKFullWidthKitTests/Utilities/ANKAssert+Shifts.swift @@ -33,12 +33,12 @@ file: StaticString = #file, line: UInt = #line) { XCTAssertEqual({ var lhs = lhs; lhs.bitshiftLeftSmart(by: rhs); return lhs }(), result, file: file, line: line) XCTAssertEqual({ var lhs = lhs; lhs.bitshiftRightSmart(by: -rhs); return lhs }(), result, file: file, line: line) //=------------------------------------------= - if (0 ..< lhs.bitWidth) ~= rhs { + if 0 ..< lhs.bitWidth ~= rhs { XCTAssertEqual( lhs &<< rhs, result, file: file, line: line) XCTAssertEqual({ var lhs = lhs; lhs &<<= rhs; return lhs }(), result, file: file, line: line) } //=------------------------------------------= - if (0 ..< lhs.bitWidth) ~= rhs { + if 0 ..< lhs.bitWidth ~= rhs { XCTAssertEqual(lhs.bitshiftedLeft(by: rhs), result, file: file, line: line) XCTAssertEqual({ var lhs = lhs; lhs.bitshiftLeft(by: rhs); return lhs }(), result, file: file, line: line) @@ -46,7 +46,7 @@ file: StaticString = #file, line: UInt = #line) { XCTAssertEqual({ var lhs = lhs; lhs.bitshiftLeft(words: words, bits: bits); return lhs }(), result, file: file, line: line) } //=------------------------------------------= - if (0 ..< lhs.bitWidth) ~= rhs, bits.isZero { + if 0 ..< lhs.bitWidth ~= rhs, bits.isZero { XCTAssertEqual(lhs.bitshiftedLeft(words: words), result, file: file, line: line) XCTAssertEqual({ var lhs = lhs; lhs.bitshiftLeft(words: words); return lhs }(), result, file: file, line: line) } @@ -70,12 +70,12 @@ file: StaticString = #file, line: UInt = #line) { XCTAssertEqual({ var lhs = lhs; lhs.bitshiftRightSmart(by: rhs); return lhs }(), result, file: file, line: line) XCTAssertEqual({ var lhs = lhs; lhs.bitshiftLeftSmart(by: -rhs); return lhs }(), result, file: file, line: line) //=------------------------------------------= - if (0 ..< lhs.bitWidth) ~= rhs { + if 0 ..< lhs.bitWidth ~= rhs { XCTAssertEqual( lhs &>> rhs, result, file: file, line: line) XCTAssertEqual({ var lhs = lhs; lhs &>>= rhs; return lhs }(), result, file: file, line: line) } //=------------------------------------------= - if (0 ..< lhs.bitWidth) ~= rhs { + if 0 ..< lhs.bitWidth ~= rhs { XCTAssertEqual(lhs.bitshiftedRight(by: rhs), result, file: file, line: line) XCTAssertEqual({ var lhs = lhs; lhs.bitshiftRight(by: rhs); return lhs }(), result, file: file, line: line) @@ -83,7 +83,7 @@ file: StaticString = #file, line: UInt = #line) { XCTAssertEqual({ var lhs = lhs; lhs.bitshiftRight(words: words, bits: bits); return lhs }(), result, file: file, line: line) } //=------------------------------------------= - if (0 ..< lhs.bitWidth) ~= rhs, bits.isZero { + if 0 ..< lhs.bitWidth ~= rhs, bits.isZero { XCTAssertEqual(lhs.bitshiftedRight(words: words), result, file: file, line: line) XCTAssertEqual({ var lhs = lhs; lhs.bitshiftRight(words: words); return lhs }(), result, file: file, line: line) } diff --git a/Tests/ANKSignedKitBenchmarks/ANKSigned+Addition.swift b/Tests/ANKSignedKitBenchmarks/ANKSigned+Addition.swift index a0998694..09a8cd88 100644 --- a/Tests/ANKSignedKitBenchmarks/ANKSigned+Addition.swift +++ b/Tests/ANKSignedKitBenchmarks/ANKSigned+Addition.swift @@ -31,7 +31,7 @@ final class ANKSignedBenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(T.min) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -42,7 +42,7 @@ final class ANKSignedBenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(T.min) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -53,7 +53,7 @@ final class ANKSignedBenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(T.min) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -68,7 +68,7 @@ final class ANKSignedBenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(D.min) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs + rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -79,7 +79,7 @@ final class ANKSignedBenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(D.min) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &+ rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -90,7 +90,7 @@ final class ANKSignedBenchmarksOnAddition: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(D.min) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.addingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) diff --git a/Tests/ANKSignedKitBenchmarks/ANKSigned+Comparisons.swift b/Tests/ANKSignedKitBenchmarks/ANKSigned+Comparisons.swift index 4bbb21d8..5c737cb6 100644 --- a/Tests/ANKSignedKitBenchmarks/ANKSigned+Comparisons.swift +++ b/Tests/ANKSignedKitBenchmarks/ANKSigned+Comparisons.swift @@ -31,7 +31,7 @@ final class ANKSignedBenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(1, as: .plus )) var rhs = ANK.blackHoleIdentity(T(1, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs == rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -42,7 +42,7 @@ final class ANKSignedBenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(1, as: .plus )) var rhs = ANK.blackHoleIdentity(T(1, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs < rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -53,7 +53,7 @@ final class ANKSignedBenchmarksOnComparisons: XCTestCase { var lhs = ANK.blackHoleIdentity(T(1, as: .plus )) var rhs = ANK.blackHoleIdentity(T(1, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.compared(to: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -68,7 +68,7 @@ final class ANKSignedBenchmarksOnComparisons: XCTestCase { var abc = ANK.blackHoleIdentity(T(1, as: .plus )) var xyz = ANK.blackHoleIdentity(T(1, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isZero) ANK.blackHole(xyz.isZero) @@ -81,7 +81,7 @@ final class ANKSignedBenchmarksOnComparisons: XCTestCase { var abc = ANK.blackHoleIdentity(T(1, as: .plus )) var xyz = ANK.blackHoleIdentity(T(1, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isLessThanZero) ANK.blackHole(xyz.isLessThanZero) @@ -94,7 +94,7 @@ final class ANKSignedBenchmarksOnComparisons: XCTestCase { var abc = ANK.blackHoleIdentity(T(1, as: .plus )) var xyz = ANK.blackHoleIdentity(T(1, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.isMoreThanZero) ANK.blackHole(xyz.isMoreThanZero) diff --git a/Tests/ANKSignedKitBenchmarks/ANKSigned+Multiplication.swift b/Tests/ANKSignedKitBenchmarks/ANKSigned+Multiplication.swift index d18ea892..79b0ef5e 100644 --- a/Tests/ANKSignedKitBenchmarks/ANKSigned+Multiplication.swift +++ b/Tests/ANKSignedKitBenchmarks/ANKSigned+Multiplication.swift @@ -31,7 +31,7 @@ final class ANKSignedBenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(4, as: .plus )) var rhs = ANK.blackHoleIdentity(T(4, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -42,7 +42,7 @@ final class ANKSignedBenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(4, as: .plus )) var rhs = ANK.blackHoleIdentity(T(4, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -53,7 +53,7 @@ final class ANKSignedBenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(4, as: .plus )) var rhs = ANK.blackHoleIdentity(T(4, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -64,7 +64,7 @@ final class ANKSignedBenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(4, as: .plus )) var rhs = ANK.blackHoleIdentity(T(4, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -79,7 +79,7 @@ final class ANKSignedBenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(4, as: .plus )) var rhs = ANK.blackHoleIdentity(D(4, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs * rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -90,7 +90,7 @@ final class ANKSignedBenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(4, as: .plus )) var rhs = ANK.blackHoleIdentity(D(4, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &* rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -101,7 +101,7 @@ final class ANKSignedBenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(4, as: .plus )) var rhs = ANK.blackHoleIdentity(D(4, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedReportingOverflow(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -112,7 +112,7 @@ final class ANKSignedBenchmarksOnMultiplication: XCTestCase { var lhs = ANK.blackHoleIdentity(T(4, as: .plus )) var rhs = ANK.blackHoleIdentity(D(4, as: .minus)) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.multipliedFullWidth(by: rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) diff --git a/Tests/ANKSignedKitBenchmarks/ANKSigned+Negation.swift b/Tests/ANKSignedKitBenchmarks/ANKSigned+Negation.swift index 5d88965a..801cff42 100644 --- a/Tests/ANKSignedKitBenchmarks/ANKSigned+Negation.swift +++ b/Tests/ANKSignedKitBenchmarks/ANKSigned+Negation.swift @@ -30,7 +30,7 @@ final class ANKSignedBenchmarksOnNegation: XCTestCase { func testNegated() { var abc = ANK.blackHoleIdentity(T.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(-abc) ANK.blackHoleInoutIdentity(&abc) } @@ -39,7 +39,7 @@ final class ANKSignedBenchmarksOnNegation: XCTestCase { func testNegatedReportingOverflow() { var abc = ANK.blackHoleIdentity(T.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(abc.negatedReportingOverflow()) ANK.blackHoleInoutIdentity(&abc) } diff --git a/Tests/ANKSignedKitBenchmarks/ANKSigned+Subtraction.swift b/Tests/ANKSignedKitBenchmarks/ANKSigned+Subtraction.swift index daa0911d..a041a6c1 100644 --- a/Tests/ANKSignedKitBenchmarks/ANKSigned+Subtraction.swift +++ b/Tests/ANKSignedKitBenchmarks/ANKSigned+Subtraction.swift @@ -31,7 +31,7 @@ final class ANKSignedBenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(T.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -42,7 +42,7 @@ final class ANKSignedBenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(T.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -53,7 +53,7 @@ final class ANKSignedBenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(T.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -68,7 +68,7 @@ final class ANKSignedBenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(D.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs - rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -79,7 +79,7 @@ final class ANKSignedBenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(D.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs &- rhs) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs) @@ -90,7 +90,7 @@ final class ANKSignedBenchmarksOnSubtraction: XCTestCase { var lhs = ANK.blackHoleIdentity(T.max) var rhs = ANK.blackHoleIdentity(D.max) - for _ in 0 ..< 1_000_000 { + for _ in 0 ..< 5_000_000 { ANK.blackHole(lhs.subtractingReportingOverflow(rhs)) ANK.blackHoleInoutIdentity(&lhs) ANK.blackHoleInoutIdentity(&rhs)