On 05/05/14 03:36 AM, Urban Hafner wrote:
> Hey all,
> 
> a question from a Rust newbie here. From languages like C or C++ I'm
> used to being able to compile each file separately into object files to
> speed up the compilation process. In Rust that doesn't seem to be easily
> possible. I tried to simulate it by compiling each module into a
> separate library, but it has been pointed out to me that it's not
> idiomatic but may not even improve performance [1]. As this stack
> overflow question is quite hidden away I'd love to get everyone's input.
> And even though writing the automatic Makefile [2] for it was fun I
> wouldn't mind having an easier solution.

Crates are Rust's compilation unit, so splitting into many crates is
equivalent to splitting into many object files in C++. It's true that
splitting will often not improve compile time, but that applies just as
much to C++. If your goal is to improve compile-time, then you need to
think carefully about how you organize the crates. Keep in mind that
generic / inline code will be recompiled for each crate using the code.

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to