timeUnits
Override the automatic detection of timeunits for metrics related to time to a specific one (auto should work for most use cases).
var timeUnits: BenchmarkTimeUnitsOverride the automatic detection of timeunits for metrics related to time to a specific one (auto should work for most use cases).
var timeUnits: BenchmarkTimeUnitsimport BenchmarkBenchmark allows you to easily create sophisticated Swift performance benchmarks
struct ConfigurationThe configuration settings for running a benchmark.
final class BenchmarkDefines a benchmark
enum BenchmarkTimeUnitsTime units for cpu/wall clock time
var maxDuration: DurationThe maximum wall clock runtime for the benchmark, currenty defaults to .seconds(1) if not set
var maxIterations: IntThe maximum number of iterations for the benchmark., currently defaults to 10K iterations if not set
var metrics: [BenchmarkMetric]Defines the metrics that should be measured for the benchmark
var skip: BoolWhether to skip this test (convenience for not having to comment out tests that have issues)
var thresholds: [BenchmarkMetric : BenchmarkThresholds]?Customized threshold tolerances for a given metric for the Benchmark used for checking for regressions/improvements/equality.
var scalingFactor: BenchmarkScalingFactorSpecifies the number of logical subiterations being done, supporting scaling of metrics accordingly. E.g. .kilo will scale results with 1000. Any subiteration done in the benchmark should use for _ in benchmark.scaledIterations for the number of iterations.
var units: [BenchmarkMetric : BenchmarkUnits]Override the automatic detection of units for metrics not related to time to a specific one
var warmupIterations: IntSpecifies a number of warmup iterations should be performed before the measurement to reduce outliers due to e.g. cache population
init(from decoder: any Decoder) throws init(metrics: [BenchmarkMetric] = defaultConfiguration.metrics, tags: [String : String] = defaultConfiguration.tags, timeUnits: BenchmarkTimeUnits = defaultConfiguration.timeUnits, units: [BenchmarkMetric : BenchmarkUnits] = defaultConfiguration.units, warmupIterations: Int = defaultConfiguration.warmupIterations, scalingFactor: BenchmarkScalingFactor = defaultConfiguration.scalingFactor, maxDuration: Duration = defaultConfiguration.maxDuration, maxIterations: Int = defaultConfiguration.maxIterations, skip: Bool = defaultConfiguration.skip, thresholds: [BenchmarkMetric : BenchmarkThresholds]? = defaultConfiguration.thresholds, setup: Benchmark.BenchmarkSetupHook? = nil, teardown: Benchmark.BenchmarkTeardownHook? = nil) var setup: Benchmark.BenchmarkSetupHook?Optional per-benchmark specific setup done before warmup and all iterations
var tags: [String : String]Specifies the parameters used to define the benchmark.
var teardown: Benchmark.BenchmarkTeardownHook?Optional per-benchmark specific teardown done after final run is done