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

Allow '/' in test name (rust) #26

Merged
merged 2 commits into from
Apr 27, 2020
Merged

Allow '/' in test name (rust) #26

merged 2 commits into from
Apr 27, 2020

Conversation

morenol
Copy link
Contributor

@morenol morenol commented Apr 26, 2020

The latest version of criterion.rs allow us to generate a bencher like output with cargo bench -- --output-format bencher so we can use the current extractCargoResult to parse them.

If you see the way that the report is done there, the title of the test can have '/', therefore I changed a the regex in order to allow names with that character. You can see that working in https://github.com/morenol/kvs/pull/2/checks?check_run_id=620736396

I am adding here the key parts, just to save you time:

https://github.com/bheisler/criterion.rs/blob/7e2d02b5d89ca87a1d2e5c8ddbce33c2077a51f6/src/report.rs#L752

https://github.com/bheisler/criterion.rs/blob/7e2d02b5d89ca87a1d2e5c8ddbce33c2077a51f6/src/report.rs#L228

https://github.com/bheisler/criterion.rs/blob/7e2d02b5d89ca87a1d2e5c8ddbce33c2077a51f6/src/report.rs#L123

This is related to: #8

Note that I took and squashed the changes from #10 (except by the readme change)

@morenol morenol marked this pull request as draft April 26, 2020 21:19
* npm run test wouldn't work until i updated `write.ts`
* Tests added

* add cargo and target to ignore
* add workflow
* Make working benchmark
@morenol
Copy link
Contributor Author

morenol commented Apr 26, 2020

Note that I took the example from https://bheisler.github.io/criterion.rs/book/user_guide/comparing_functions.html to create the benchmark_group.

@morenol morenol marked this pull request as ready for review April 26, 2020 22:07
}

fn bench_fib_20(c: &mut Criterion) {
c.bench_function("BenchFib20", move |b| {
Copy link
Contributor Author

@morenol morenol Apr 26, 2020

Choose a reason for hiding this comment

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

Note that we can add whitespaces and other characters to the bench title that would make the title doesn't match with the extract regex.

I didn't add it because I am not sure if you want to add whitespaces and possibly other characters to the regex and because this can be avoided by the owner of the repo that is running this action by just renaming the bench title.

Copy link
Member

Choose a reason for hiding this comment

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

ok. When someone complains about that, let's consider to support spaces by making output parser smarter.

Use criterion rs
@rhysd
Copy link
Member

rhysd commented Apr 27, 2020

Is this PR intended to be merged after #10 is merged?

@morenol
Copy link
Contributor Author

morenol commented Apr 27, 2020

No, I think that #10 is not needed anymore.

@pksunkara
Copy link
Contributor

Yup, #10 can be closed

@rhysd
Copy link
Member

rhysd commented Apr 27, 2020

Since I'm currently not a user of Criterion.rs, I'm not understanding the situation. Why is #10 not necessary? Did it change the output format?

@pksunkara
Copy link
Contributor

Yes, we got criterion to add support for output format that is compatible with bencher which supports this action.

@morenol
Copy link
Contributor Author

morenol commented Apr 27, 2020

You can see in the changelog of criterion.rs for the version 0.3.2 that it was added support to get a bencher-like output

@rhysd
Copy link
Member

rhysd commented Apr 27, 2020

Oh, that's good news. I did not know that. Then what we should add to our implementation is only this line and it looks good. I'll merge this.

@rhysd rhysd merged commit e47c97d into benchmark-action:master Apr 27, 2020
@rhysd rhysd mentioned this pull request Apr 27, 2020
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.

3 participants