In large C++ projects (take Firefox as an example), it's actually the other way around: merging a lot of .cpp files to compile larger but fewer translation units gives you *much* faster builds (and better optimization, at least without LTO).
My advice is to split your (large) program into a few libs where it makes sense, but to not go as far as putting each module in its own lib. Cheers, Nical On Mon, May 5, 2014 at 9:36 AM, Urban Hafner <[email protected]>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. > > Urban > > [1] > http://stackoverflow.com/questions/23385582/problems-with-gnu-make-dynamic-rules > [2] > https://github.com/ujh/iomrascalai/blob/3d37ddd95c2058386f748f23c1a2b2e538375093/Makefile > -- > Freelancer > > Available for hire for Ruby, Ruby on Rails, and JavaScript projects > > More at http://urbanhafner.com > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev > >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
