Code organization for large monolith projects

Hi. Our project became pretty big, 27KLOC of Rust and 83 direct dependencies, which doesn't bother me by itself. What I'm rather bothered by is that the compilation/recompilation takes quite a while. Type checking is quite swift (so, writing the code and getting the results of cargo check is OK), but whenever you want to run the results to check, even the non-release is taking significantly longer than it was at the beginning.

I would like to think about splitting the project into a multi-crate thing, trying to extract as many external dependencies as possible into separate crates which don't change that often, so my intuition is telling me to:

  • extract things using libraries like headless chrome, images processing etc. into a separate crate
  • extract things which don't change very often into external crates, treating them as a library

But before doing all that, I'd like to ask for more experience others had. Is my intuition correct, or are there better strategies I should pay attention to?

Thank you!

p.s.: I did this already which helped A LOT:

[target.x86_64-unknown-linux]
linker = "ld.lld"
1 Like

Probably relevant: Large Rust Workspaces

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.