Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6e39bca
Add Cargo Criterion JSON extractor and accompanying tests
brainstorm Dec 21, 2022
983f6f4
Test passing, next up is to consolidate types of the action with crit…
brainstorm Dec 22, 2022
04dcc2c
Shove the rest of criterion-rs 'extra' attributes for future reuse
brainstorm Dec 22, 2022
96184cc
Elaborate on how to use cargo-criterion tool, store-native-benchmark-…
brainstorm Dec 22, 2022
7d3c1e4
A bit more clarification on what remains to be done on the extraction…
brainstorm Dec 22, 2022
d5e0fa8
A bit more clarification on what remains to be done on the extraction…
brainstorm Dec 22, 2022
9107127
Merge branch 'cargo-criterion-tool-extractor' of github.com:brainstor…
brainstorm Dec 22, 2022
e372285
Minor couple of fixes
brainstorm Dec 23, 2022
91812bc
npm lint -- --fix for my extract additions
brainstorm Dec 23, 2022
2d3818f
Minor changes and cleanups, following CONTRIBUTING.md a bit more closely
brainstorm Jan 2, 2023
3258e95
High severity bugfix for node dependency
brainstorm Jan 3, 2023
319d18b
VSCode formatting broke the ndJSON structure of the test, introducing…
brainstorm Jan 4, 2023
ee2d9d4
ndJSON works now, need to rework how tests are run and/or reduce test…
brainstorm Jan 4, 2023
23533a5
tsconfig.app.json nowhere to be found upstream and editor was complai…
brainstorm Jan 4, 2023
25b4485
Trim ndJSON for test purposes
brainstorm Jan 4, 2023
b833235
Fix ndJSON tests
brainstorm Jan 4, 2023
b202622
Remove stray console.log()
brainstorm Jan 4, 2023
96aa94d
Focus on ndJSON which generalises well for cargo criterion
brainstorm Jan 4, 2023
cd8ef6f
Remove TODOs regarding ndJSONs
brainstorm Jan 4, 2023
e5e442f
Clarify cargo-criterion vs regular criterion bencher output
brainstorm Jan 4, 2023
325bdb9
Further cross-reference and clarify cargo bench vs cargo criterion us…
brainstorm Jan 4, 2023
fd70914
Draft support for storing native cargo-criterion benchmarking outputs
brainstorm Jan 4, 2023
cb57814
Tackle various npm run lint concerns, bypass tests for cargo-criterio…
brainstorm Jan 4, 2023
29cad31
Fix native benchmark report keeping
brainstorm Jan 5, 2023
b65a71a
Fix release script
brainstorm Jan 5, 2023
b5888bc
Fix lint
brainstorm Jan 5, 2023
8b02e70
git pull is not needed on release script
brainstorm Jan 5, 2023
300d1ac
Document the nativeBenchmarkDataDirPath option on main and tool READMEs
brainstorm Jan 5, 2023
31f611d
Merge branch 'master' into cargo-criterion-tool-extractor
brainstorm Feb 16, 2023
adbc6d7
Merge branch 'master' into cargo-criterion-tool-extractor
brainstorm Mar 5, 2023
092a6a8
Merge branch 'master' into cargo-criterion-tool-extractor
brainstorm May 16, 2023
bf5d5ef
Merge branch 'master' into cargo-criterion-tool-extractor
brainstorm Aug 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
/coverage
/dist
/.idea
.release
target/
jmh-result.json
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ and monitor the results on GitHub Actions workflow.

This action currently supports the following tools:

- [`cargo bench`][cargo-bench] for Rust projects
- [`cargo bench`][cargo-bench] and [`cargo criterion`][cargo-criterion] for Rust projects
- `go test -bench` for Go projects
- [benchmark.js][benchmarkjs] for JavaScript/TypeScript projects
- [pytest-benchmark][] for Python projects with [pytest][]
Expand Down Expand Up @@ -83,6 +83,10 @@ context) properties. Like this:
]
```

Furthermore, option `nativeBenchmarkDataDirPath` will also store your tool's native reports under github pages, i.e:

https://umccr.github.io/htsget-rs/dev/bench/native/criterion/reports/

## Screenshots

### Charts on GitHub Pages
Expand Down Expand Up @@ -639,6 +643,7 @@ Every release will appear on your GitHub notifications page.
[java-badge]: https://github.com/benchmark-action/github-action-benchmark/workflows/JMH%20Example/badge.svg
[github-action]: https://github.com/features/actions
[cargo-bench]: https://doc.rust-lang.org/cargo/commands/cargo-bench.html
[cargo-criterion]: https://crates.io/crates/cargo-criterion
[benchmarkjs]: https://benchmarkjs.com/
[gh-pages]: https://pages.github.com/
[examples-page]: https://benchmark-action.github.io/github-action-benchmark/dev/bench/
Expand Down
24 changes: 23 additions & 1 deletion examples/criterion-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,22 @@ e.g.

Note that you should run the benchmarks using the bencher output format.

If one wishes to use JSON as output format, you can install `cargo-criterion` crate with the accompanying `tool:` YAML definition in the action:

```yaml
- name: Install cargo-criterion
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-criterion
- name: Run benchmarks
run: cargo criterion 1> output.json
```

Further details are described in [the cargo-criterion Rust example](../rust/README.md).

## Process benchmark results

Store the benchmark results with step using the action. Please set `cargo` to `tool` input.
Store the benchmark results with step using the action. Please set `cargo` to `tool` input:

```yaml
- name: Store benchmark result
Expand All @@ -34,4 +46,14 @@ Store the benchmark results with step using the action. Please set `cargo` to `t
output-file-path: output.txt
```

Or `cargo-criterion` if JSON output is preferred instead.

```yaml
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'cargo-criterion'
output-file-path: output.json
```

Please read ['How to use' section](https://github.com/benchmark-action/github-action-benchmark#how-to-use) for common usage.
47 changes: 45 additions & 2 deletions examples/rust/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Rust example for benchmarking with `cargo bench`
================================================
# Rust example for benchmarking with `cargo bench`

- [Workflow for this example](../../.github/workflows/rust.yml)
- [Action log of this example](https://github.com/benchmark-action/github-action-benchmark/actions?query=workflow%3A%22Rust+Example%22)
Expand Down Expand Up @@ -46,4 +45,48 @@ Store the benchmark results with step using the action. Please set `cargo` to `t

Please read ['How to use' section](https://github.com/benchmark-action/github-action-benchmark#how-to-use) for common usage.

# Rust example for benchmarking with `cargo-criterion`

In the previous section, both regular and criterion-rs can be used through the regular `cargo bench` facility, but there's an additional crate and cargo extension named [`cargo-criterion`][cargo-criterion].

The improvements in [cargo-criterion][cargo-criterion] do [match the goals of github-action-benchmark](https://crates.io/crates/cargo-criterion#goals), so it makes sense to include support for it.


## Run benchmarks

Official documentation for usage of `cargo criterion`:

https://bheisler.github.io/criterion.rs/book/cargo_criterion/cargo_criterion.html

.e.g:

```yaml
- name: Run benchmarks
run: cargo criterion 1> output.json
```

If you have a group of benchmarks, cargo criterion will output a [ndJSON][ndjson].

## Process benchmarks results

There are two notable differences in cargo-criterion:

1. Since the output is machine-readable JSON, the extract process only parses the result file and maps the required data into github-action-benchmark plotting system. In fact, [cargo-criterion][cargo-criterion] only supports JSON as `message-format` (output format).
2. cargo-criterion incorporates [its own HTML benchmark reports system][criterion-rs-own-html], which can be stored alongside if desired through the `native-benchmark-data-dir-path`.

```yaml
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'cargo-criterion'
output-file-path: output.json
native-benchmark-data-dir-path: target/criterion
```

The native benchmark reports is simply copied from `target/criterion/reports` and pushed to the github results repo so that they are available under:

https://YOUR_ORG.github.io/YOUR_REPO/dev/bench/native/criterion/reports/

[cargo-criterion]: https://crates.io/crates/cargo-criterion
[criterion-rs-own-html]: https://bheisler.github.io/criterion.rs/book/user_guide/plots_and_graphs.html
[ndjson]: http://ndjson.org/
Loading