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 more benchmarks #1152
base: master
Are you sure you want to change the base?
Add more benchmarks #1152
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.
Looks good to me.
@cmyr can you take alook. I don't have approval rights. |
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.
Noticed while reading this PR that some of our existing benchmarks (including ones that were used as inspiration here) seem to have some problems.
This isn't the fault of this PR, just this PR is making me notice it. (The original problem is at least partially my own fault 💁♂️)
Maybe a good project before this PR would be to try and update some of the existing benchmarks to correct this problem?
let mut offset = 25_000; | ||
b.iter(|| { | ||
text.edit(offset..=offset, &insertion); | ||
offset += 150; |
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.
Reading this is making me wonder if a bunch of these benchmarks (the existing ones) aren't poorly structured.
Specifically, everything in b.iter(|| {
should be identical between each run, but we're regularly changing external state. This means that different runs are running different code, which sort of defeats the purpose of benchmarking.
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.
Good catch. I removed my review. @kanishkarj do you think we can have a PR fixing the outlined issue from @cmyr, this means removing the change of state (e.g. offset += 150) in the iteration? We should fix this for the edit.rs benchmark cases and then rebase your PR on top of it.
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.
Consider it done. :)
Added a few more benchmarks.