-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add SPEEDTEST
#10920
Add SPEEDTEST
#10920
Conversation
r? @llogiq (rustbot has picked a reviewer for you, use r? to override) |
9b0099f
to
7a49175
Compare
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.
I usually put a Instant::now().elapsed() check in a lint myself when making a PR to see roughly what impact it has, so this would be really nice to have if it was directly supported! I have one question tho:
let mut sum = 0; | ||
for _ in 0..iterations { | ||
let start = std::time::Instant::now(); | ||
f(); | ||
sum += start.elapsed().as_millis(); | ||
} |
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.
since the timing itself also takes some time to run, would it make sense to move the timing stuff out of the loop and divide the time taken by the number of iterations after the loop? the Instant::now().elapsed() overhead might also be negligible compared to how long a lint pass takes, so maybe this doesn't matter that much (from what I remember, it was around 40ns on the playground...)
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.
I think the usual way to micro benchmark is to time variable numbers of iterations, then do a linear regression, but this is clearly a macro benchmark, so don't worry about either loop or time measurement overhead.
☔ The latest upstream changes (presumably #10426) made this pull request unmergeable. Please resolve the merge conflicts. |
Since this PR popped up in my notifications and to continue something @blyxyas started: Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @llogiq (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
=^.^= |
Thank you! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
1 similar comment
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
In the
master
branch, we currently don't have any way to test the performance of a single lint in changes.This PR adds
SPEEDTEST
, the environment variable which lets you do a speed test on a lint / category of tests with various configuration options.Maybe we should merge this with
lintcheck
🤔See the book page for more information.
changelog:none