Tracking down long build times

Is there a way to get a good idea of which modules (or functions, or trait impls...) in a crate are most responsible for long build times? I mean, I know I can use -Ztime-passes to figure out whether the time is spent in macros, or trans, or type checking... but there isn't a whole lot that this information means to me. (after all, it's largely for debugging rust's performance issues)

I know this is somewhat of an ill-posed question, since various factors muddy the question of "who's responsible" (such as the inlining of functions into other functions, and the fact that a generic function in one crate may be monomorphized in another). But maybe there is at least something out there that can give me a clearer picture of what the relationship is between my crate's build time, and the code in it?

Not directly answering (cause I don’t know the answer :slight_smile:) but have you tried extrapolating what it might be by playing with cargo bloat? You’ve probably seen this, but the clap author wrote up a good blog post about using it to trim clap down; the trimming is for binary size but that also reduces amount of compiled code. Unless you have one or two places showing some pathology in the compiler, it might just be “death by a thousand cuts”.

Just ran across https://github.com/rust-lang-nursery/rustc-perf/issues/232 :slight_smile: