-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
EDIT(Centril): The crate was renamed to rustc_middle in #70536.
EDIT(jyn514): Most of rustc_middle was split into rustc_query_impl in #70951.
The results from @ehuss's new cargo -Ztimings feature really drive home how the size of the rustc crate hurts compile times for the compiler. Here's a picture:

Things to note.
- The
rustccrate takes about twice as long to compile as therustc_mircrate, which is the second-biggest crate. - Sixteen dependent crates start and finish their entire compilation while the
rustccrate's codegen is happening. (Thank goodness for pipelining, it really makes a difference in this case.) - Almost 1/3 of the total build time occurs while building the
rustccrate without anything else happening in parallel (from 42-67s, and from 141-174s).
Also, even doing check builds on rustc code is painful. On my fast 28-core Linux box it takes 10-15 seconds even for the first compile error to come up. This is much longer than other crates. Refactorings within the rustc crate that require many edit/compile cycles are painful.
I've been told that rustc is quite tangled and splitting it up could be difficult. That may well be true. The good news is that the picture shows we don't need to split it into 10 equal-sized pieces to get benefits. Even splitting off small chunks into separate crates will have an outsized effect on compilation times.