Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add more benchmarks #1152

wants to merge 2 commits into from

Conversation

kanishkarj
Copy link
Contributor

Added a few more benchmarks.

dsp
dsp previously approved these changes Mar 28, 2019
Copy link
Contributor

@dsp dsp left a 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.

@dsp
Copy link
Contributor

dsp commented Mar 28, 2019

@cmyr can you take alook. I don't have approval rights.

Copy link
Member

@cmyr cmyr left a 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;
Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider it done. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants