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:
commit
71ecf5d359
5 changed files with 113 additions and 3 deletions
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue