From efd3abef9e756b46fd837ba2a9253c92d94302d8 Mon Sep 17 00:00:00 2001 From: mehbark Date: Sun, 5 Oct 2025 01:06:31 -0400 Subject: [PATCH] add compression ratio output --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 277f716..9a8949b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,7 +43,14 @@ where bitbuf.clear(); let header = Scheme::encode(buf, bitbuf); let len_freq = Scheme::header_size(&header) + bitbuf.len().div_ceil(8); - println!("{name:>10}: {len_freq:>10}"); + + #[allow(clippy::cast_precision_loss)] + let compression_ratio = len_freq as f32 / buf.len() as f32; + + println!( + "{name:>10}: {len_freq:>10} ({:5.1}%)", + compression_ratio * 100. + ); if debug { eprintln!("{name} header: {header:#?}\n"); }