Skip to content

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

@saethlin

Description

@saethlin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions