Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-crate #[inline] functions are handled badly in unoptimized builds #30933

Closed
jonas-schievink opened this issue Jan 15, 2016 · 2 comments
Closed

Comments

@jonas-schievink
Copy link
Contributor

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).

@dotdash
Copy link
Contributor

dotdash commented Jan 15, 2016

Looks like a dupe of #14527

@jonas-schievink
Copy link
Contributor Author

Ah I knew this was already tracked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants