mirror of https://github.com/zcash/orchard.git
commit
a5de219cee
|
@ -1,29 +1,35 @@
|
||||||
name: Benchmarks
|
name: Benchmarks
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
permissions:
|
||||||
CARGO_TERM_COLOR: always
|
contents: write
|
||||||
|
deployments: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
benchmark:
|
||||||
name: Run orchard benchmarks
|
name: Performance regression check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
CRITERION_TOKEN: ${{ secrets.CRITERION_TOKEN }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Run benchmarks
|
- uses: actions-rs/toolchain@v1
|
||||||
run: |
|
with:
|
||||||
# run benchmarks and save baseline in a directory called "new"
|
toolchain: 1.51.0
|
||||||
cargo bench -- --verbose
|
override: true
|
||||||
- name: Upload benchmarks
|
- name: Run benchmark
|
||||||
run: |
|
run: cargo bench -- --output-format bencher | tee output.txt
|
||||||
# upload the files
|
- name: Store benchmark result
|
||||||
bash <(curl -s https://criterion.dev/bash)
|
uses: benchmark-action/github-action-benchmark@v1
|
||||||
|
with:
|
||||||
|
name: Orchard Benchmarks
|
||||||
|
tool: 'cargo'
|
||||||
|
output-file-path: output.txt
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
auto-push: true
|
||||||
|
# Show alert with commit comment on detecting possible performance regression
|
||||||
|
alert-threshold: '200%'
|
||||||
|
comment-on-alert: true
|
||||||
|
fail-on-alert: true
|
||||||
|
alert-comment-cc-users: '@str4d'
|
||||||
|
|
|
@ -25,7 +25,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|
||||||
let vk = VerifyingKey::build();
|
let vk = VerifyingKey::build();
|
||||||
let pk = ProvingKey::build();
|
let pk = ProvingKey::build();
|
||||||
|
|
||||||
for num_recipients in 1..=4 {
|
let create_bundle = |num_recipients| {
|
||||||
let mut builder = Builder::new(
|
let mut builder = Builder::new(
|
||||||
Flags::from_parts(true, true),
|
Flags::from_parts(true, true),
|
||||||
Anchor::from_bytes([0; 32]).unwrap(),
|
Anchor::from_bytes([0; 32]).unwrap(),
|
||||||
|
@ -43,9 +43,16 @@ fn criterion_benchmark(c: &mut Criterion) {
|
||||||
.map(|a| a.to_instance(*bundle.flags(), *bundle.anchor()))
|
.map(|a| a.to_instance(*bundle.flags(), *bundle.anchor()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
{
|
(bundle, instances)
|
||||||
let mut group = c.benchmark_group("proving");
|
};
|
||||||
group.sample_size(10);
|
|
||||||
|
let recipients_range = 1..=4;
|
||||||
|
|
||||||
|
{
|
||||||
|
let mut group = c.benchmark_group("proving");
|
||||||
|
group.sample_size(10);
|
||||||
|
for num_recipients in recipients_range.clone() {
|
||||||
|
let (bundle, instances) = create_bundle(num_recipients);
|
||||||
group.bench_function(BenchmarkId::new("bundle", num_recipients), |b| {
|
group.bench_function(BenchmarkId::new("bundle", num_recipients), |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
bundle
|
bundle
|
||||||
|
@ -55,9 +62,12 @@ fn criterion_benchmark(c: &mut Criterion) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut group = c.benchmark_group("verifying");
|
let mut group = c.benchmark_group("verifying");
|
||||||
|
for num_recipients in recipients_range {
|
||||||
|
let (bundle, instances) = create_bundle(num_recipients);
|
||||||
let bundle = bundle
|
let bundle = bundle
|
||||||
.create_proof(&pk)
|
.create_proof(&pk)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
Loading…
Reference in New Issue