It seems to me there are three options for caching the compiled code:
- ASTs - Generated LLVM bitcode - Compiled code
ASTs are probably useless since most of our time is spent in trans and LLVM. Generated bitcode avoids re-running trans and avoids issues around inlining as well, but still requires that we pay the full LLVM price. Caching compiled code will, I would guess, be the most complex and result in slower executables since LLVM will not be optimizing the whole crate as a unit, though if we're doing a non-optimizing build that's obviously fine. I kind of think caching LLVM bitcode is the best "bang for our buck" but I could be persuaded otherwise.
One other comment on items vs files: in general, rustc quickly forgets the file from which code originated, so I actually think doing the caching at the level of items or modules will be the easiest.
Dependencies
- ASTs
- Generated LLVM bitcode
- Compiled code
ASTs are probably useless since most of our time is spent in trans and LLVM. Generated bitcode avoids re-running trans and avoids issues around inlining as well, but still requires that we pay the full LLVM price. Caching compiled code will, I would guess, be the most complex and result in slower executables since LLVM will not be optimizing the whole crate as a unit, though if we're doing a non-optimizing build that's obviously fine. I kind of think caching LLVM bitcode is the best "bang for our buck" but I could be persuaded otherwise.
One other comment on items vs files: in general, rustc quickly forgets the file from which code originated, so I actually think doing the caching at the level of items or modules will be the easiest.