aboutsummaryrefslogtreecommitdiff
path: root/vendor/weezl/benches
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
committerValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
commita990de90fe41456a23e58bd087d2f107d321f3a1 (patch)
tree15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/weezl/benches
parent3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff)
downloadfparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz
fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip
Deleted vendor folder
Diffstat (limited to 'vendor/weezl/benches')
-rw-r--r--vendor/weezl/benches/msb8.rs54
1 files changed, 0 insertions, 54 deletions
diff --git a/vendor/weezl/benches/msb8.rs b/vendor/weezl/benches/msb8.rs
deleted file mode 100644
index a7e5dc5..0000000
--- a/vendor/weezl/benches/msb8.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-extern crate criterion;
-extern crate weezl;
-
-use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
-use std::fs;
-use weezl::{decode::Decoder, BitOrder, LzwStatus};
-
-pub fn criterion_benchmark(c: &mut Criterion, file: &str) {
- let data = fs::read(file).expect("Benchmark input not found");
- let mut group = c.benchmark_group("msb-8");
- let id = BenchmarkId::new(file, data.len());
- let mut outbuf = vec![0; 1 << 26]; // 64MB, what wuff uses..
- let mut decode_once = |data: &[u8]| {
- let mut decoder = Decoder::new(BitOrder::Msb, 8);
- let mut written = 0;
- let outbuf = outbuf.as_mut_slice();
- let mut data = data;
- loop {
- let result = decoder.decode_bytes(data, &mut outbuf[..]);
- let done = result.status.expect("Error");
- data = &data[result.consumed_in..];
- written += result.consumed_out;
- black_box(&outbuf[..result.consumed_out]);
- if let LzwStatus::Done = done {
- break;
- }
- if let LzwStatus::NoProgress = done {
- panic!("Need to make progress");
- }
- }
- written
- };
- group.throughput(Throughput::Bytes(decode_once(&data) as u64));
- group.bench_with_input(id, &data, |b, data| {
- b.iter(|| {
- decode_once(data);
- })
- });
-}
-
-pub fn bench_toml(c: &mut Criterion) {
- criterion_benchmark(c, "benches/Cargo-8-msb.lzw");
-}
-
-pub fn bench_binary(c: &mut Criterion) {
- criterion_benchmark(c, "benches/binary-8-msb.lzw");
-}
-
-pub fn bench_lib(c: &mut Criterion) {
- criterion_benchmark(c, "benches/lib-8-msb.lzw");
-}
-
-criterion_group!(benches, bench_toml, bench_binary, bench_lib);
-criterion_main!(benches);