From 7ccf66f672b7e96f51ab87a13893f274d2c05942 Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Tue, 30 Jul 2024 13:53:54 -0500 Subject: [PATCH] feat: add benchmark for FilteredImageReader basic use --- benches/benchmarks.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs index dea26e72..5ef16f53 100644 --- a/benches/benchmarks.rs +++ b/benches/benchmarks.rs @@ -12,7 +12,7 @@ use rxing::oned::{ }; use rxing::pdf417::PDF417Reader; use rxing::qrcode::QRCodeReader; -use rxing::MultiFormatReader; +use rxing::{FilteredImageReader, MultiFormatReader}; use rxing::{BinaryBitmap, BufferedImageLuminanceSource, Reader}; use std::path::Path; @@ -206,6 +206,17 @@ fn multi_barcode_benchmark(c: &mut Criterion) { }); } +fn multi_barcode_filtered_reader_benchmark(c: &mut Criterion) { + let mut image = get_image("test_resources/blackbox/multi-1/1.png"); + c.bench_function("multi_barcode", |b| { + b.iter(|| { + + let mut reader = GenericMultipleBarcodeReader::new(FilteredImageReader::new(MultiFormatReader::default())); + let _res = reader.decode_multiple(&mut image); + }); + }); +} + criterion_group!( benches, aztec_benchmark, @@ -224,6 +235,7 @@ criterion_group!( telepen_benchmark, upca_benchmark, upce_benchmark, - multi_barcode_benchmark + multi_barcode_benchmark, + multi_barcode_filtered_reader_benchmark, ); criterion_main!(benches);