Skip to content

Commit

Permalink
benches: introduce minimal decoding performance test
Browse files Browse the repository at this point in the history
  • Loading branch information
dspicher committed Feb 6, 2025
1 parent e8ca2fd commit bbf09e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ minicbor = { version = "0.25", features = ["alloc"] }
rand_xoshiro = "0.7"

[dev-dependencies]
criterion = "0.5"
hex = "0.4"
qrcode = { version = "0.14", default-features = false }

[features]
default = ["std"]
std = []

[[bench]]
name = "decode"
harness = false
9 changes: 9 additions & 0 deletions benches/decode.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use ur::decode;

fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("decode bytes", |b| b.iter(|| decode(black_box("ur:bytes/hdeymejtswhhylkepmykhhtsytsnoyoyaxaedsuttydmmhhpktpmsrjtgwdpfnsboxgwlbaawzuefywkdplrsrjynbvygabwjldapfcsdwkbrkch"))));
}

criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);

0 comments on commit bbf09e4

Please sign in to comment.