Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ harness = false
name = "throughput_lzfi"
harness = false

[[bench]]
name = "throughput_lzseqr"
harness = false

[[bench]]
name = "stages_bwt"
harness = false
Expand All @@ -61,10 +65,6 @@ harness = false
name = "stages_lzss"
harness = false

[[bench]]
name = "stages_lz78"
harness = false

[[bench]]
name = "stages_lz_comparison"
harness = false
Expand Down
33 changes: 0 additions & 33 deletions benches/stages_lz78.rs

This file was deleted.

11 changes: 0 additions & 11 deletions benches/stages_lz_comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ fn bench_lz_comparison(c: &mut Criterion) {
group.bench_with_input(BenchmarkId::new("lzss_compress", size), &data, |b, data| {
b.iter(|| pz::lzss::encode(data).unwrap());
});
group.bench_with_input(BenchmarkId::new("lz78_compress", size), &data, |b, data| {
b.iter(|| pz::lz78::encode(data).unwrap());
});

let lz77_c = pz::lz77::compress_lazy(&data).unwrap();
let lzss_c = pz::lzss::encode(&data).unwrap();
let lz78_c = pz::lz78::encode(&data).unwrap();

group.bench_with_input(
BenchmarkId::new("lz77_decompress", size),
Expand All @@ -40,13 +36,6 @@ fn bench_lz_comparison(c: &mut Criterion) {
b.iter(|| pz::lzss::decode(c).unwrap());
},
);
group.bench_with_input(
BenchmarkId::new("lz78_decompress", size),
&lz78_c,
|b, c| {
b.iter(|| pz::lz78::decode(c).unwrap());
},
);

group.finish();
}
Expand Down
11 changes: 0 additions & 11 deletions benches/stages_lz_plus_fse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ fn bench_lz_plus_fse(c: &mut Criterion) {
},
);

group.bench_with_input(
BenchmarkId::new("lz78_fse_compress", size),
&data,
|b, data| {
b.iter(|| {
let lz = pz::lz78::encode(data).unwrap();
pz::fse::encode(&lz)
});
},
);

group.finish();
}

Expand Down
23 changes: 23 additions & 0 deletions benches/throughput_lzseqr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#[path = "throughput_common.rs"]
mod throughput_common;

use criterion::{criterion_group, criterion_main, Criterion};
use pz::pipeline::Pipeline;
use throughput_common::{run_throughput_benches, ThroughputBenchSpec};

const SPEC: ThroughputBenchSpec = ThroughputBenchSpec {
id: "lzseqr",
pipeline: Pipeline::LzSeqR,
parallel: true,
large: true,
decompress_large: true,
webgpu: false,
webgpu_large: false,
};

fn bench(c: &mut Criterion) {
run_throughput_benches(c, &SPEC);
}

criterion_group!(benches, bench);
criterion_main!(benches);
2 changes: 1 addition & 1 deletion docs/exec-plans/tech-debt-tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Catalog of known issues, gaps, and technical debt in libpz. Items are prioritize
- `fuzz_pipeline_roundtrip` — all 9 pipelines compress/decompress roundtrip
- `fuzz_decompress` — arbitrary bytes to decompress (crash resistance)
- `fuzz_bwt`, `fuzz_rans`, `fuzz_fse`, `fuzz_huffman` — entropy coding roundtrips
- `fuzz_lz77`, `fuzz_lz78`, `fuzz_lzss`, `fuzz_lzseq` — LZ family roundtrips
- `fuzz_lz77`, `fuzz_lzss`, `fuzz_lzseq` — LZ family roundtrips
- `fuzz_rle`, `fuzz_mtf` — simple codec roundtrips
- Each target tests encode→decode roundtrip AND arbitrary-bytes decode crash resistance
- Requires: `rustup toolchain install nightly && cargo install cargo-fuzz`
Expand Down
4 changes: 1 addition & 3 deletions examples/explore_pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,14 @@ fn main() {
(Pipeline::Lzf, ParseStrategy::Optimal, 1, Backend::Cpu),
(Pipeline::Bw, ParseStrategy::Auto, 1, Backend::Cpu),
(Pipeline::Bbw, ParseStrategy::Auto, 1, Backend::Cpu),
// Experimental: LZSS and LZ78 pipelines
// Experimental: LZSS pipeline
(Pipeline::LzssR, ParseStrategy::Auto, 1, Backend::Cpu),
(Pipeline::Lz78R, ParseStrategy::Auto, 1, Backend::Cpu),
// Multi-threaded CPU
(Pipeline::Deflate, ParseStrategy::Lazy, 0, Backend::Cpu),
(Pipeline::Lzf, ParseStrategy::Lazy, 0, Backend::Cpu),
(Pipeline::Bw, ParseStrategy::Auto, 0, Backend::Cpu),
(Pipeline::Bbw, ParseStrategy::Auto, 0, Backend::Cpu),
(Pipeline::LzssR, ParseStrategy::Auto, 0, Backend::Cpu),
(Pipeline::Lz78R, ParseStrategy::Auto, 0, Backend::Cpu),
];

// WebGPU GPU variants (if available)
Expand Down
77 changes: 77 additions & 0 deletions examples/pipeline_comparison.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
use pz::pipeline::{self, Pipeline};
use std::time::Instant;

fn main() {
println!("\n=== Pipeline Compression Comparison ===\n");

// Test with different data patterns
test_pipeline_comparison("repetitive", generate_repetitive(256 * 1024));
test_pipeline_comparison("sequential", generate_sequential(256 * 1024));
test_pipeline_comparison("structured", generate_structured(256 * 1024));
}

fn test_pipeline_comparison(name: &str, data: Vec<u8>) {
println!("Test data: {} ({} bytes)", name, data.len());
println!("{:-<80}", "");

let pipelines = vec![
("Lzr (LZ77+rANS)", Pipeline::Lzr),
("Lzf (LZ77+FSE)", Pipeline::Lzf),
("LzSeqR (LzSeq+rANS)", Pipeline::LzSeqR),
("Deflate (LZ77+Huffman)", Pipeline::Deflate),
];

println!(
"{:<25} {:<15} {:<15} {:<15}",
"Pipeline", "Compressed", "Ratio %", "Time (ms)"
);
println!("{:-<70}", "");

for (label, pipeline) in pipelines {
let start = Instant::now();
match pipeline::compress(&data, pipeline) {
Ok(compressed) => {
let elapsed = start.elapsed().as_secs_f64() * 1000.0;
let ratio = (compressed.len() as f64 / data.len() as f64) * 100.0;
println!(
"{:<25} {:<15} {:<15.2} {:<15.3}",
label,
format!("{} bytes", compressed.len()),
ratio,
elapsed
);
}
Err(e) => {
println!("{:<25} ERROR: {}", label, e);
}
}
}
println!();
}

fn generate_repetitive(size: usize) -> Vec<u8> {
let pattern =
b"The quick brown fox jumps over the lazy dog. This is a test pattern for compression. ";
let mut data = Vec::with_capacity(size);
while data.len() < size {
let remaining = size - data.len();
let chunk = remaining.min(pattern.len());
data.extend_from_slice(&pattern[..chunk]);
}
data
}

fn generate_sequential(size: usize) -> Vec<u8> {
(0..size).map(|i| (i % 256) as u8).collect()
}

fn generate_structured(size: usize) -> Vec<u8> {
let json_pattern = br#"{"key":"value","number":123,"nested":{"field":"data"}}"#;
let mut data = Vec::with_capacity(size);
while data.len() < size {
let remaining = size - data.len();
let chunk = remaining.min(json_pattern.len());
data.extend_from_slice(&json_pattern[..chunk]);
}
data
}
5 changes: 0 additions & 5 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ name = "fuzz_lz77"
path = "fuzz_targets/fuzz_lz77.rs"
doc = false

[[bin]]
name = "fuzz_lz78"
path = "fuzz_targets/fuzz_lz78.rs"
doc = false

[[bin]]
name = "fuzz_lzss"
path = "fuzz_targets/fuzz_lzss.rs"
Expand Down
23 changes: 0 additions & 23 deletions fuzz/fuzz_targets/fuzz_lz78.rs

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/fuzz_targets/fuzz_pipeline_roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ fuzz_target!(|data: &[u8]| {
Pipeline::Lzf,
Pipeline::Lzfi,
Pipeline::LzssR,
Pipeline::Lz78R,
Pipeline::LzSeqR,
];

Expand Down
3 changes: 0 additions & 3 deletions src/bin/pz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ fn list_pipelines() {
("lzf", "4", "LZ77 + FSE (zstd-style entropy coding)"),
("lzfi", "5", "LZSS + interleaved FSE (fast CPU decode)"),
("lzssr", "6", "LZSS + rANS (experimental)"),
("lz78r", "7", "LZ78 + rANS (experimental)"),
("lzseqr", "8", "LzSeq + rANS (zstd-style code+extra-bits)"),
("lzseqh", "9", "LzSeq + Huffman (fast decode)"),
("sortlz", "10", "Sort-based LZ77 + FSE (GPU experiment)"),
Expand Down Expand Up @@ -245,7 +244,6 @@ fn parse_args() -> Opts {
"lzf" | "4" => Pipeline::Lzf,
"lzfi" | "5" => Pipeline::Lzfi,
"lzssr" | "6" => Pipeline::LzssR,
"lz78r" | "7" => Pipeline::Lz78R,
"lzseqr" | "8" => Pipeline::LzSeqR,
"lzseqh" | "9" => Pipeline::LzSeqH,
"sortlz" | "10" => Pipeline::SortLz,
Expand Down Expand Up @@ -441,7 +439,6 @@ fn list_file(path: &str, data: &[u8]) -> Result<(), String> {
4 => "lzf",
5 => "lzfi",
6 => "lzssr",
7 => "lz78r",
8 => "lzseqr",
9 => "lzseqh",
10 => "sortlz",
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub mod fse;
pub mod gzip;
pub mod huffman;
pub mod lz77;
pub mod lz78;
pub mod lzseq;
pub mod lzss;
pub mod mtf;
Expand Down
Loading