2 ms·
When tightly controlled, Rust compilation times are quite good. Without attention it can bloat tremendously with proc macros and excessive generics (turn them
by Groxx 4y ago
When tightly controlled, Rust compilation times are quite good. Without attention it can bloat tremendously with proc macros and excessive generics (turn them into dyns!), but it's totally manageable. Depending on your corners of the ecosystem, your default experience could be a few orders of magnitude better or worse than someone else's.
- nu11ptr 4y agoI haven't done much experimentation, but I've heard the same. Currently, for new projects I try to design with as many crates as possible in order to a) keep them small b) make as many 'spokes' (aka not dependent on other crates) as possible. This helps a ton and something I wish I'd have known before starting some of my large projects. I also wish I had used more trait objects and less generics - the overhead rarely matters in practice.
- Groxx 4y agoTraits vs generics: yeah, personally I hope to one day see a language that allows application developers to decide what gets monomorphized, rather than library developers. It seems like you could usually just synthesize the boxing needed. So why would you ever leave that choice in the library's hands, which has no idea how it will be used?
- rane 4y agoMind expanding on the b) a bit? If by that you mean writing things from scratch instead of pulling a dependency that does it already, it sounds a bit counterintuitive.
- Groxx 4y agoI believe they mean spokes as opposed to "wheels with other spokes", i.e. leaves vs trees. The best dependency trees are as short and wide as possible. It means fewer changes with each upgrade, fewer chances of conflicts between them, and generally more-parallel compilation and better build caching. Which is true in every language, but every community seems to need to relearn it from scratch.