Skip to content

Commit

Permalink
adjust wording
Browse files Browse the repository at this point in the history
  • Loading branch information
willow-ahrens committed Dec 23, 2024
1 parent dd8bf6b commit a08e889
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/groups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ allocs(group::BenchmarkGroup) = mapvals(allocs, group)
params(group::BenchmarkGroup) = mapvals(params, group)

ratio(groups::BenchmarkGroup...) = mapvals(ratio, groups...)

"""
judge(target::BenchmarkGroup, baseline::BenchmarkGroup; [time_tolerance::Float64=0.05])
"""
function judge(groups::BenchmarkGroup...; kwargs...)
return mapvals((x...) -> judge(x...; kwargs...), groups...)
end
Expand Down
13 changes: 9 additions & 4 deletions src/trials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ function ratio(a::Real, b::Real)
return Float64(a / b)
end

"""
ratio(target::TrialEstimate, baseline::TrialEstimate)
Returns a ratio of the target estimate to the baseline estimate, as e.g. `time(target)/time(baseline)`.
"""
function ratio(a::TrialEstimate, b::TrialEstimate)
ttol = max(params(a).time_tolerance, params(b).time_tolerance)
mtol = max(params(a).memory_tolerance, params(b).memory_tolerance)
Expand Down Expand Up @@ -219,12 +224,12 @@ ratio(t::TrialJudgement) = t.ratio
params(t::TrialJudgement) = params(ratio(t))

"""
judge(a::TrialEstimate, b::TrialEstimate; [time_tolerance::Float64=0.05])
judge(groups::BenchmarkGroup..., [time_tolerance::Float64=0.05])
judge(target::TrialEstimate, baseline::TrialEstimate; [time_tolerance::Float64=0.05])
Report if the estimate passed as first argument represents a regression versus the second estimate.
Report on whether the first estimate `target` represents a regression or an improvement with respect to the second estimate `baseline`.
"""
judge(a::TrialEstimate, b::TrialEstimate; kwargs...) = judge(ratio(a, b); kwargs...)
judge(target::TrialEstimate, baseline::TrialEstimate; kwargs...) =
judge(ratio(target, baseline); kwargs...)

"""
judge(r::TrialRatio, [time_tolerance::Float64=0.05])
Expand Down

0 comments on commit a08e889

Please sign in to comment.