Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Don't use a single monolithic crate. Break your project up into multiple crates. Not only does this help with compile time (the individual crate compiles can be parallelized), it also tends to help with API design as well.


Every project I've worked on used a workspace with many crates. Generally that only gets you so far on large projects.


It compiles different files separately, right?

With some exceptions for core data structures, it seems that if you only modified a few files in a large project the total compilation time would be quick no matter how slow the compiler was.


Sorta. The "compilation unit" is a single crate, but rustc is now also parallel, and LLVM can also be configured to run in parallel IIRC.

Rust compile times have been improving over time as the compiler gets incrementally rewritten and optimised.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: