- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 386
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
Added option to manually specify a reference to compare the results to. #744
Conversation
Thank you very much for your contribution. Sorry for the delayed review. This looks very good from a first glance. How does this new Also, please consider creating (integration) tests for this new option. |
Thanks for having a look. The reference is specified separately from all other options, so also separately from a scan and has to be specified fully.
Will have a look at addings tests. Thanks again! |
Currently working on the tests. Was thinking about how Currently i have modified it so that prepare and conclude affect the reference and the number needed is (n_commands + 1/0). For command name the easiest would be to not affect the reference, but instead add a separate option |
src/benchmark/scheduler.rs
Outdated
println!( | ||
"{}{} times faster than {}", | ||
"{}{} times {} than {}", |
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.
Can we maybe fix this for the Equal
case? Even if it is unlikely to happen in practice (?)
- "2 times faster than …" makes sense
- "2 times slower than …" makes sense
- "2 times as fast than …" is wrong and makes no sense.
Maybe we could print: "As fast (1.0 ± 0.2) as …"
Would probably make sense to add a test for this as well.
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.
Changed it as you suggested. Although i am not 100% on the alignment of the message. At the moment i have prefixed it with 4 spaces so that it is aligned with single digit double decimal ratios (2.34). The ratio itself for the same time ones will always be (1.00)
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.
Thank you very much for the updates and explanations. This looks great. Only have two minor comments.
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.
Thank you!
@sharkdp @JanEricNitschke Did |
@tony Looking back over the code it looks like this was not added. So i think you can file an issue. Although i feel that this would also be a good option for a PR. I think that shouldnt be too difficult and i also created this here as my first (and only) on the project because i wanted it. |
Thank you for adding this feature. A follow-up question in general: Shouldn't be also the |
@miluoshi Probably a good idea. I think you can probably create a PR to add documentation for this. Otherwise i might do it when i get around to it |
Add --reference-name option to give a reference command a name. This was discussed in the PR that added --reference, sharkdp#744, but was unfortunately never implemented.
Add --reference-name option to give a reference command a name. This was discussed in the PR that added --reference, sharkdp#744, but was unfortunately never implemented.
I was interested in the functionality discussed in #579 and #577.
Sadly the former PR has been stale for over a year.
So i have tried to effectively take the work from there, make it fit with the changes that have happend since then and also address the comments in the PR.
There are currently still two points that i am myself unsure about.
I have used the standard
std::cmp::Ordering
for the ordering compared to the reference. However, i feel that the naming is not actually clear at a first glance. Namely thatOrdering::Less
corresponds to a faster time (the runtime is less). It might be worth to create a distinct enum that maps to this (converts from) as suggested in the original PR review.I am also not sure if the statements
faster than
andslower than
are the best. Particularly the latter feels a bit unintuitive to me.Maybe something like
0.2 times as fast
would be better than5.0 times slower
?