Good day, I would like to ask you, could you give me a good tip on a crate that can compress and decompress? I would need it to be fast enough, but mainly to be able to greatly reduce the size of the vector that I will compress.
Good general-purpose compression formats are Gzip, Bzip2, and LZMA (in approximately increasing order of compression ratio and decreasing order of speed). You can try using their corresponding crates (usually they have more than one Rust implementation), and look for something else if they are not fast or efficiently-compressing enough.
Can you say more about the nature of the data you need to compress?
If you need to select between multiple crate options, https://lib.rs is an excellent site to get a quick popularity overview.
i will mainly compress vec of u8 but not strictli unicode characters
and currently i started using crate:
xz 0.1.0 but still curious if i can find any better
2022-12-21 19:56 GMT+01:00, Riking via The Rust Programming Language
Forum notifications@rust-lang.discoursemail.com:
Define “better”. The problem with compression algorithms is that here in theory, theory and practice are the same, but in practice, they are not reaches insane dimensions.
Because in theory when we are talking random data compressors couldn't exist at all.
In practice they, of course, exist. But that because we are not processing random data.
Yet that, in turn, means that question about “best compressor” becomes entirely meaningless: best for what, best who, what trade-offs are we talking about?
best for text that doesn't have to be strictly utf8
xz crate fit my needs and i also wanted to test lzma2 to see if it
will fit better but i didn't found good maintained crate like this.
also i tested bzip2 but xz giving smaller size at the end which is
good because it will be used for udp packets
2022-12-22 15:03 GMT+01:00, Vorfeed Canal via The Rust Programming
Language Forum notifications@rust-lang.discoursemail.com:
7z, xz, lzma2 all use the same underlaying algorithm, only outer wrapping changes.
This I don't think it would be significantly different.
You can also try brotli which has optimizations for text. (it can be comparable to gzip: faster but less efficient than lzma). There are C bindings and a full-Rust crate, but the latter looks like a direct translation from C (and when I tested, it had the same performance).
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.