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

inline(always) use probably causes large incremental build time regressions #146

Open
saethlin opened this issue Oct 15, 2024 · 0 comments

Comments

@saethlin
Copy link

From rust-lang/rfcs#3711 (comment)

My original finding is this perf report: rust-lang/rust#121417 (comment) which is based on a compiler diff that just makes #[inline(always)] not emit the LLVM attribute alwaysinline in unoptimized builds. LLVM will inline functions with alwaysinline even in unoptimized builds (I don't know if rustc sets up some specific pass list to make this happen).

And in optimized builds the always-inliner runs first, so #[inline(always)] on a function that will be inlined anyway may produce better optimizations. I believe we have examples of compiler performance fluctuations that certainly indicate this effect can produce different optimizations, which are sometimes better.

So I think what you really want is a cfg or a feature like you have in regex; the tripping hazard is that the compiler doesn't provide a way to change your attributes based on the optimization level.

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

1 participant