mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
35 lines
587 B
Swift
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)
|
|
}
|
|
|
|
}
|