From 9b7bd5696a21496fa0c38a17e69c5c0658acfe73 Mon Sep 17 00:00:00 2001 From: Genny Date: Mon, 11 Oct 2021 03:35:38 -0500 Subject: Implement images iterator --- benches/lzw_encode.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'benches') diff --git a/benches/lzw_encode.rs b/benches/lzw_encode.rs index 33440b2..aacf4a3 100644 --- a/benches/lzw_encode.rs +++ b/benches/lzw_encode.rs @@ -1,13 +1,23 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use rand::{thread_rng, Rng}; use gifed::LZW; +use rand::{thread_rng, Rng}; +use weezl::{encode::Encoder, BitOrder}; pub fn criterion_benchmark(c: &mut Criterion) { - let mut random = [0u8; 255]; - thread_rng().fill(&mut random[..]); + let mut random = [0u8; 2048]; + thread_rng().fill(&mut random[..]); - c.bench_function("lzw encode 255bytes", |b| b.iter(|| LZW::encode(8, black_box(&random)))); + c.bench_function("lzw encode 255bytes", |b| { + b.iter(|| LZW::encode(8, black_box(&random))) + }); + c.bench_function("weezl encode 255bytes", |b| { + b.iter(|| { + Encoder::new(BitOrder::Msb, 8) + .encode(black_box(&random)) + .unwrap() + }) + }); } criterion_group!(benches, criterion_benchmark); -criterion_main!(benches); \ No newline at end of file +criterion_main!(benches); -- cgit 1.4.1-3-g733a5