Description
Consider this simple code:
fn main() {
let _ = Vec::<u8>::new();
}
When generating LLVM IR on the Playpen, my browser freezes for several seconds. With debug info, this generates 85 KiB of LLVM IR (1319 loc), without debug info its still 41K (857 loc).
The LLVM IR contains dozens of functions declared in std
or core
: Drop glue, Deref
impls, even allocation functions and iterators (presumably used by the drop glue)! Despite being marked #[inline]
, all of these functions should be available inside of std
and core
and so we could just link to them instead of retranslating all of them.
Interestingly, because we're compiling everything in debug mode, no function calls will actually get inlined and the inlined functions will run slower then if we would just link to their optimized counterparts (since AFAIK std
and core
are always shipped with optimizations).
This worsens compile times and unoptimized code performance (although I haven't measured by how much).