Hacker News new | ask | show | jobs
by estebank 1488 days ago
Try to debug where your compile times are going[1][2], but if you want a good rule of thumb: separate your crate into multiple if you can (that way incremental compilation will yield better results), switch to an alternative linker, like mold or lld, and use trait objects instead of generics (monomorphization can be expensive during compilation, while trait objects can be slower at runtime, but not enough to be worth it worrying about it).

[1]: https://fasterthanli.me/articles/why-is-my-rust-build-so-slo...

[2]: https://matklad.github.io/2021/09/04/fast-rust-builds.html

1 comments

Thanks to some hints in those articles (basically, enabling incremental builds on release mode), I've been able to remove about 70% (yes!) of the build time :-)

Thanks!