Description
#122568 was a significant size regression for Rust metadata. The extra information that is stored in MIR bodies now is a bunch of Ty<'tcx>
, so in memory I think this is actually not that much. But it seems like in our metadata format this takes up quite a bit of space. This not only makes the library files bigger, it also accounts for a large fraction (I think even the majority) of the compile-time regression from that PR.
I don't know if there's something that can be done to improve this -- either by storing different information in mentioned_items
that needs less space on disk, or by representing Ty<'tcx>
more efficiently on disk. One drastic option would be to "intern" types in the on-disk format, i.e. have one global table of types that everything else just indexes into. That would certainly save space when the same type appears multiple times. I don't know if that is what happens here though.