Description
Currently, we always compress crate metadata for dylibs and proc-macros:
rust/compiler/rustc_interface/src/passes.rs
Lines 928 to 940 in ea7e131
This prevents us from mmap
-ing the metadata into memory when we decode it, since we need to read the entire file in order to decompress it.
We should allow configuring this setting via a -Z
flag (and maybe through the Cargo.toml
at some point), to allow users to trade disk space for speed. In addition to avoiding the overhead of compressing/decompressing, gaining the ability to mmap
the crate metadata means that we may avoid loading unused portions from disk entirely. This is less important for proc-macros after #76897, but might still have a noticable performance impact for dylibs.
Suggested by @joshtriplett on Zulip.