Why is rust compilation faster than Julia pre-compilation?

I think i’m rehashing what others have said a bit, but in essence I believe the difference in compile time performance is due to 3 things.

  1. Rust has spent a loot of dev time improving their compile times in the last couple years, leading to very nice improvements while julia has spent most of it’s developer time on this area on improving caching and it’s still doing that.
  2. The caching model julia uses is similar to other LISPs and smalltalk, where we basically save the session state into a big binary and reload it later, this is done because of the dinamicity of the language. This means that julia potentially saves a lot more code than it might use when it’s loaded.
  3. Julia’s compilation unit here is a package which is potentially bigger than rust’s compilation units, so precompiling for small changes is potentially a lot more expensive.

Some of the future work is to try and change our compilation model slightly, with benefits of startup time, compilation time and binary size (they all kind of scale together). One idea is to remove most of the dynamicity on specific programs, by defining entry points like main or shared library entry points, which would allow us to throw away and potentially not even compile lots of unnecessary code

22 Likes