-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: should we split the huge common crate? #11665
Comments
I think we had a discussion in early days about "small crates vs large crates". Smaller crates increase compilation speeds, but may cause performance degration since compiler optimization performs mostly on crates. Things may become more complicated when lto is involved. Personally I prefer small crates since it makes things clearer and the optimization from compiler is hard to predict. |
For reference, databend's organization is like
So we may also split other crates into smaller ones. But it doesn't necessarily help, if a crate's modules are linearly depended. e.g., Jon tried to split frontend, but
But meta might be worth splitting, as it contains so many things, and compiles so slow. #9553
It's especially good if you can avoid the common subcrate is not depended by meta.
Similar to #9878, I would recommend "if you feel painful about that you may consider refactoring a small part...". A whole refactoring doesn't necessarily help others if they never modify those code. 😇 But some developers might also be too tolerable about slow compilation, or don't know it can be improved... P.S., I've thought about this multiple times before. I think splitting |
This issue has been open for 60 days with no activity. Could you please update the status? Feel free to continue discussion or close as not planned. |
Background and motivation
In our early design, we chose to maintain “common” as a separate crate. This helped us avoid many potential circular dependency issues.
We tried to avoid adding codes that take much compile time in “common”, so the full compilation of “common” is not slow. However, the real problem occurs during incremental compilation. Due to the large number of dependents on “common”, any changes to “common” will trigger a lot of crate recompilation. This problem becomes very evident when we develop and continuously debug by adding a new “mod” in “common”.
The low incremental compilation increased our development cost, which guide us to rethink about the "huge-common-crate" decision. At least, there are many mods in common don't really depends other mods (except the real common ones, like
data_type
). Should they suffer from these meaningless re-compilation?Step-by-step migration
A huge reorg will introduce many conflicts, and make it hard to blame via git history. We can propose a step-by-step migration.
format.rs
, we can just create a directory for them, and make them a single crate.field_generator
, we can just create a newCargo.toml
file, and specify the lib path without nestedsrc
directory, so that we don't need to move files in file system.The text was updated successfully, but these errors were encountered: