class Minitest::Benchmark

def assert_performance_constant threshold = 0.99, &work

def assert_performance_constant threshold = 0.99, &work
  validation = proc do |range, times|
    a, b, rr = fit_linear range, times
    assert_in_delta 0, b, 1 - threshold
    [a, b, rr]
  end
  assert_performance validation, &work
end