Two sufficiently common ways used to improve rustc performance is to box large enum variants (and leave the others as values). To help spot such situations Rust has
-W variant-size-differences. Another used strategy is visible here:
Sometimes you extract a cold sub-function and you use
#[inline(never)]. In other cases you extract a monomorphic part of a generic code (but in this #73912 example it's used
Stroustrup has written about an idea that may be useful to reduce the templates-induced bloat:
I think it could be nice to further study how people improve the performance of rustc, to help Rust uses perform similar optimizations in their code.