You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this snippet, lzma, lzma2 and xz are done using lzma_compress, lzma2_compress and xz_compress respectively. It seemed weird to me that lzma2 and xz are so poor, so I stepped through the code and noticed that it's not applying compression at all for lzma2 and xz:
/// Compress data with LZMA2 and default [`Options`](compress/struct.Options.html).pubfnlzma2_compress<R: io::BufRead,W: io::Write>(input:&mutR,output:&mutW,) -> io::Result<()>{
encode::lzma2::encode_stream(input, output)}// ...pubfnencode_stream<R,W>(input:&mutR,output:&mutW) -> io::Result<()>whereR: io::BufRead,W: io::Write,{letmut buf = vec![0u8;0x10000];loop{let n = input.read(&mut buf)?;if n == 0{// status = EOF
output.write_u8(0)?;break;}// status = uncompressed reset dict
output.write_u8(1)?;// unpacked size
output.write_u16::<BigEndian>((n - 1)asu16)?;// contents
output.write_all(&buf[..n])?;}Ok(())}
This sounds like either a bug, or something that should be documented better. As I understand from the readme file, lzmr-rs is only a decoder which is confusing since these compression functions are present.
The text was updated successfully, but these errors were encountered:
For now, there is also a dumb encoder that only uses byte literals, with many hard-coded constants for code simplicity. Better encoders are welcome!
I can remove mention of "encoder" from the "About" description of this GitHub repo. Don't hesitate to send a PR with further suggestions on how to improve the wording in the README.
I was comparing compression methods to figure out what to choose for my project and noticed some strange results:
In this snippet, lzma, lzma2 and xz are done using
lzma_compress
,lzma2_compress
andxz_compress
respectively. It seemed weird to me that lzma2 and xz are so poor, so I stepped through the code and noticed that it's not applying compression at all for lzma2 and xz:This sounds like either a bug, or something that should be documented better. As I understand from the readme file, lzmr-rs is only a decoder which is confusing since these compression functions are present.
The text was updated successfully, but these errors were encountered: