Files
2026-02-11 19:03:14 +08:00

35 lines
587 B
Swift

// Copyright (c) 2026 Timofey Solomko
// Licensed under MIT License
//
// See LICENSE for license information
protocol Benchmark {
var defaultIterationCount: Int { get }
init(_ input: String)
func warmupIteration() -> Double
func measure() -> Double
func format(_ value: Double) -> String
}
extension Benchmark {
var defaultIterationCount: Int {
return 10
}
func warmupIteration() -> Double {
return measure()
}
func format(_ value: Double) -> String {
return SpeedFormatter.default.string(from: value)
}
}