On 11/29/2013 03:01 AM, Léo Testard wrote:
Hello,
I think everyone here will agree to say that compilation times in Rust
are problematic. Recently, there was an argument on IRC about reducing
compilation times by reducing the use of GC and failures. 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.
On some of my personal projects, I "solved" this problem by splitting
the codebase into several crates, that I compile statically, and then
link together using extern mod. This is not really a solution, because
this implies that there is no cyclic dependency between each of the
small crates, or I end up with issues trying to compile it, because
using extern mod requires that the library corresponding to that mod
exists before compiling the crate that depends on it.
But strictly speaking, a compiled crate is nothing more than a module
hierarchy, and so is a single Rust source file, so we should be able
to compile a single file to some sort of .o and then link all together
to form a crate. References to modules outside of this file just
require the first passes of the build, not the code generation, so it
should be ok regarding to cyclic dependencies, and if not, we could
still introduce some kind of auto-generated interface file, like Caml
does. I know it's quite a big work, and that the current system is
quite good, but having this is very important if we want Rust to be
used in production.
I agree that incremental recompilation would be a good thing to pursue,
and I'd be happy to see someone work on it, but as you say it is a very
difficult problem, and it's frankly a low priority. Some other
compilition performance wins to pursue are removing metadata compression
(causes dynamic linker crashes on linux), improving llvm perf, and
improving linker perf.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev