summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2024-08-15 15:55:57 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-09-10 16:00:29 +0900
commitb33c331184179bdec33109d4618e2ec0ac59544d (patch)
tree7ba8864b05f07ac9550dcc03ffb86f41f5ed9a9a
parentaf17a34c883bbfc5cefcde91f37edbe2222fda97 (diff)
Improve base time of assert_linear_performance (#11369)
Remove `.ceil` from base time calculation that makes 10x gap. This will make the assertion more strict and also less flaky.
-rw-r--r--tool/lib/core_assertions.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb
index 1dcf72ca32..acfaf00cef 100644
--- a/tool/lib/core_assertions.rb
+++ b/tool/lib/core_assertions.rb
@@ -768,7 +768,9 @@ eom
end
times.compact!
tmin, tmax = times.minmax
- tbase = 10 ** Math.log10(tmax * ([(tmax / tmin), 2].max ** 2)).ceil
+
+ # safe_factor * tmax * rehearsal_time_variance_factor(equals to 1 when variance is small)
+ tbase = 10 * tmax * [(tmax / tmin) ** 2 / 4, 1].max
info = "(tmin: #{tmin}, tmax: #{tmax}, tbase: #{tbase})"
seq.each do |i|