-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace miniz.c with a pure-Rust implementation #41770
Comments
miniz is only used in the /// Compress a buffer without writing any sort of header on the output. Fast
/// compression is used because it is almost twice as fast as default
/// compression and the compression ratio is only marginally worse.
pub fn deflate_bytes(bytes: &[u8]) -> Bytes;
/// Decompress a buffer without parsing any sort of header on the input.
pub fn inflate_bytes(bytes: &[u8]) -> Result<Bytes, Error>; |
There is also compiler-rt, but its being replaced by a pure rust implementation. |
Do you need flate specifically? The snap crate is a pure Rust snappy implementation. |
@BurntSushi If I had to guess, I'd say the purpose of this crate's inclusion is solely to operate on crate metadata. I wonder how hard it would be to go through and drop in several different implementations to benchmark different algorithms and settings. |
@est31 compiler-rt is imported as a submodule, so it is out-of-tree and off-topic for this issue I guess? Otherwise we would need to consider hoedown, jemalloc, graphviz and LLVM as well 😉. |
For how compression is used in the compiler, see #37086 for prior discussion and some experiments. @kennytm @est31 Submodule or not, all these things are still dependencies and potentially merit discussion — just not in this issue since it's specifically about miniz.c. Separate issues might be worthwhile for some of them, and also for native libraries that get pulled in via crates.io dependencies (if any). But of those @kennytm named, hoedown is temporary, LLVM is 200% impractical to get rid of, graphviz AFAIK isn't a dependency (we have "libgraphviz" but AFAIK that's a pure-Rust implementation of writing out dot files). jemalloc might be interesting, once rust-lang/rfcs#1974 merges and |
|
As of today, it looks like the only two in-tree C dependencies are libbacktrace and miniz. Unlike libbacktrace, the existence of pure-Rust (de)compression libs sounds broadly useful and feasible to implement. Determine which functions in miniz we actually need and explore whether or not any crates in our library ecosystem can serve as a suitable replacement.
The text was updated successfully, but these errors were encountered: