On 11/29/13 3:01 AM, Léo Testard wrote:
Although I
agree it's good to reduce Rustc's overhead, I think there are more
important problems. The total duration of a build matters only because
you have to recompile the whole crate on each modification. In C++, the
duration of the complete build of a project matters less because when
you compile incrementally, you only have to rebuild a couple of files -
those you modified. I know the "1 crate = 1 compilation unit" is the
model chosen by Rust, but this is a major issue for production. Nobody
will ever use Rust in production if they have to recompile thousands of
lines of code on each modification.

In practice this isn't as much of a benefit for C++ as claimed. In C++, when you change a header file you often have to rebuild huge numbers of files, and most nontrivial changes change header files. In fact, Firefox is moving away from the C++ model to a more Rust-like model of unified builds on a per-directory basis precisely because it improves compilation times. This thread [1] reports build time increases of 6x-15x!

Furthermore, when you do link-time optimization, which is generally a requirement for software that needs to be fast these days, you can't really do separate compilation at all.

I shouldn't say that Rust has no problems with build times--it could always be faster, and in particular the memory representations are inefficient, particularly around ASTs--but when you actually run with `-Z time-passes`, you'll see that the vast majority of the time for any reasonably-sized crate is spent in LLVM. There isn't much we can do to make that faster by an order of magnitude, other than to try to push on the parallel per-function optimization and codegen work that is happening in some upstream branches. Mergefunc, disabling exceptions, and the no-zeroing-out stuff that Niko is doing would be nice, but they won't improve build times by an order of magnitude.

Patrick

[1]: https://groups.google.com/forum/#!topic/mozilla.dev.platform/WjcCfckml4A

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to