-
Notifications
You must be signed in to change notification settings - Fork 293
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
[ci] add gitlab pipeline for criterion benchmarks #422
Conversation
Codecov Report
@@ Coverage Diff @@
## master #422 +/- ##
=======================================
Coverage 79.38% 79.38%
=======================================
Files 72 72
Lines 6198 6198
=======================================
Hits 4920 4920
Misses 1278 1278 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
looking forward to trying it out. what are your plans on proper formatting of the output?
.gitlab-ci.yml
Outdated
- cargo --version | ||
- rustup +nightly show | ||
- cargo +nightly --version | ||
- cargo spellcheck --version |
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.
not needed, right?
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.
Yes. It's just debug info. Will remove later
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.
please remove this line for merge
We might be able to perform the benchmark pass via GitHub Actions using the new hosted GHA runners: This would simplify our CI setup compared to having 2 different ones. |
Yes. Those ones look interesting. But they are still in beta, not sure whether they available for us right now. |
461f183
to
c4b82f4
Compare
c4b82f4
to
9c39f52
Compare
CRITERION BENCHMARKS
|
@Robbepop please take a look at the sample report above. Does it look like what is expected?
and transformed into this:
Any suggestions what needs to be improved, changed, added, etc..? |
Hey @sergejparity thank you for the update! I really like the color encodings where red indicates worse performance, green is improved performance and white is no change! Something like the following:
etc... Note that I made up the One thing we might want to do is to make benchmarks in CI more stable. Right now the benchmarks are kinda unstable since I rather wanted to make them execute faster. But for CI we could change that. Maybe we can implement it in a dynamic way that allows for both options, fast and imprecise as well as slow and precise mode. Generally I have big plans for this CI based benchmarking infrastructure. |
@Robbepop thank you for the feedback. Will update the template. What goes regarding performance, I also just using random regular runners for now. Later will tune up this component too. |
Hyped to see your updates! :) |
@Robbepop now it should be much closer to what you expect. |
@sergejparity yes it looks pretty good to me! Great job! 🚀 One small nit is that I'd love if the benchmark names were written in Is this PR done? |
Here you go :) |
.gitlab-ci.yml
Outdated
- cargo --version | ||
- rustup +nightly show | ||
- cargo +nightly --version | ||
- cargo spellcheck --version |
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.
please remove this line for merge
echo "PARSING MASTER REPORT" | ||
sed -e 's/^Found.*//g' \ | ||
-e 's/^\s\+[[:digit:]].*$//g' \ | ||
-e 's/\//_/g' \ | ||
-e 's/^[a-z0-9_]\+/"&": {/g' \ | ||
-e 's/time:\s\+\[.\{10\}/"time": "/g' \ | ||
-e 's/.\{10\}\]/"},/g' \ | ||
-e '1s/^/{\n/g' \ | ||
-e '/^$/d' \ | ||
-e 's/ */ /g' \ | ||
-e 's/^ *\(.*\) *$/\1/' $1 \ | ||
| sed -z 's/.$//' \ | ||
| sed -e '$s/.$/}/g' \ | ||
| tee target/criterion/output_master.json |
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.
As a follow up to this PR we should try to make this part more readable.
For example criterion supports JSON output as well: https://bheisler.github.io/criterion.rs/book/cargo_criterion/external_tools.html
And with tools such as jq
we could significantly make extracting information more readable.
I will merge this PR and propose a follow-up PR for you. :) Is that okay with you?
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.
Agree. My homegrown parsing "engine" looks ugly. And definitely can be improved.
But json export tool you mention is a part of cargo-criterion
which is under development. By the way, have you tried it in action?
Reports from cargo bench
also produces jsons with raw data in target/criterion
. I've tried to use them as well, but found that even it is possible get execution times and other metrics. Only thing stopped me from using it is that I forced to write my own statistics analysis tool to interpret them :)
So parsing raw command line output to json appeared easier solution.
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.
Upd: tried to install and use cargo-criterion
and first attempt was not successful:
Benchmarking compile_and_validate/v1thread 'main' panicked at 'could not open benchmark file benches/wasm/wasm_kernel/target/wasm32-unknown-unknown/release/wasm_kernel.wasm: No such file or directory (os er', wasmi_v1/benches/bench/mod.rs : 16 : 33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Benchmarking compile_and_validate/v1: Warming up for 1.0000 sthread 'main' panicked at 'Unexpected message FinishedBenchmarkGroup { group: "compile_and_validate/v1" }', /home/sergej/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/cargo-criterion-1.1.0/src/bench_target.rs:306:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Error { kind: UnexpectedEof, message: "failed to fill whole buffer" })', /home/sergej/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/criterion-0.4.0/src/benchmark_group.rs:380:18
stack backtrace:
Double checked benches/wasm/wasm_kernel/target/wasm32-unknown-unknown/release/wasm_kernel.wasm
is in place. What could be the reason for failure.
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.
The problem with raw command line output compared to the JSON output (or genreally machine readable output) is that the former is subject to change whereas the latter is kinda guaranteed to be stable to not break dependents. Therefore as a long term non-brittle solution we really really want to read output that is intended to be machine readable.
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.
Upd: tried to install and use
cargo-criterion
and first attempt was not successful:Benchmarking compile_and_validate/v1thread 'main' panicked at 'could not open benchmark file benches/wasm/wasm_kernel/target/wasm32-unknown-unknown/release/wasm_kernel.wasm: No such file or directory (os er', wasmi_v1/benches/bench/mod.rs : 16 : 33 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Benchmarking compile_and_validate/v1: Warming up for 1.0000 sthread 'main' panicked at 'Unexpected message FinishedBenchmarkGroup { group: "compile_and_validate/v1" }', /home/sergej/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/cargo-criterion-1.1.0/src/bench_target.rs:306:26 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Error { kind: UnexpectedEof, message: "failed to fill whole buffer" })', /home/sergej/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/criterion-0.4.0/src/benchmark_group.rs:380:18 stack backtrace:
Double checked
benches/wasm/wasm_kernel/target/wasm32-unknown-unknown/release/wasm_kernel.wasm
is in place. What could be the reason for failure.
You are probably doing this in the root directory instead of the wasmi_v1
subdirectory.
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.
You are right. Now it works, at first glance json's produced by cargo-criterion
are almost what is needed. Of course some processing also is needed to produce readable output, like time conversion from ns into more convenient units. But at least we'll have an out-of-the-box machine readable data
Thanks a lot @sergejparity for this great work! I will merge this PR now and will write some issues for future work items for you and the benchmarking CI. :) 🚀 |
No description provided.