-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Improve base time of assert_linear_performance #11369
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -825,7 +825,7 @@ def assert_linear_performance(seq, rehearsal: nil, pre: ->(n) {n}) | |||
end | |||
times.compact! | |||
tmin, tmax = times.minmax | |||
tbase = 10 ** Math.log10(tmax * ([(tmax / tmin), 2].max ** 2)).ceil | |||
tbase = 10 * tmax * [(tmax / tmin) ** 2 / 4, 1].max |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment why we use this calculation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
Could you rebase on master before you merge this? @nobu Do you want to review this before we merge this? |
Remove `.ceil` from base time calculation that makes 10x gap. This will make the assertion more strict and also less flaky.
7845c59
to
d76671f
Compare
Rebased |
Oh, sorry. I've set auto-merge. |
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.
Remove `.ceil` from base time calculation that makes 10x gap. This will make the assertion more strict and also less flaky.
Remove `.ceil` from base time calculation that makes 10x gap. This will make the assertion more strict and also less flaky.
Base time of linear performance assertion was using this calculation.
There is a 10x gap. When rehearsal time exceeds some threshold, tbase becomes 10x large.
It can potentially make the assertion loose and also flaky.
Note that test in ruby/rexml uses
seq = [10000, 50000, 100000, 150000, 200000]
I think this pull request makes the assertion more strict and also less flaky.