Skip to content

[benchmark] Documentation for legacyFactor #24307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions benchmark/utils/TestsUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ public struct BenchmarkInfo {
return _tearDownFunction
}

/// DON'T USE ON NEW BENCHMARKS!
/// Optional `legacyFactor` is a multiplication constant applied to runtime
/// statistics reported in the benchmark summary (it doesn’t affect the
/// individual sample times reported in `--verbose` mode).
///
/// It enables the migration of benchmark suite to smaller workloads (< 1 ms),
/// which are more robust to measurement errors from system under load,
/// while maintaining the continuity of longterm benchmark tracking.
///
/// Most legacy benchmarks had workloads artificially inflated in their main
/// `for` loops with a constant integer factor and the migration consisted of
/// dividing it so that the optimized runtime (-O) was less than 1000 μs and
/// storing the divisor in `legacyFactor`. This effectively only increases the
/// frequency of measurement, gathering more samples that are much less likely
/// to be interrupted by a context switch.
public var legacyFactor: Int?

public init(name: String, runFunction: @escaping (Int) -> (), tags: [BenchmarkCategory],
Expand Down