1
Fork 0

Auto merge of #98851 - klensy:encode_symbols, r=cjgillot

rustc_metadata: dedupe strings to prevent multiple copies in rmeta/query cache blow file size

r? `@cjgillot`

Encodes strings in rmeta/query cache so duplicated ones will be encoded as offsets to first strings, reducing file size.
This commit is contained in:
bors 2022-08-18 23:53:22 +00:00
commit 71ecf5d359
5 changed files with 113 additions and 3 deletions

View file

@ -1852,14 +1852,14 @@ impl fmt::Display for Symbol {
}
impl<S: Encoder> Encodable<S> for Symbol {
fn encode(&self, s: &mut S) {
default fn encode(&self, s: &mut S) {
s.emit_str(self.as_str());
}
}
impl<D: Decoder> Decodable<D> for Symbol {
#[inline]
fn decode(d: &mut D) -> Symbol {
default fn decode(d: &mut D) -> Symbol {
Symbol::intern(&d.read_str())
}
}