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.

Sorry if this topic has already been posted several times, but I feel this
is important, and the related issues seem to date (#2369). I think it's a
real mistake to report this to post-1.0.

Leo
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to