mirrord
mirrord copied to clipboard
Reduce compile time
Right now compile time is quite long, and we don't have that much code. Use this issue to track possible performance gains. Concrete issues that can be worked on:
- [ ] #223
- [ ] #222
- [ ] #221
- [x] #220
I saw that lto
was marked true
, aka fat
, in cargo.toml. Has thin
been tested? https://doc.rust-lang.org/cargo/reference/profiles.html#lto
@jo3bingham Thanks for the suggestion. My main concern when opening this issue was mainly CI and not release, which happens less often and we can "pay" the time for better performance.
I have two thoughts on this:
- There is a heavy usage of derive macros, specifically with
thiserror:Error
. I know that these things reduce the need for extra boilerplate code but with the cost of longer compile times. Maybe some of those errors in theerror.rs
files could be implemented by hand? - Another possibility (although I don't know just by how much this will affect the compile times) is to use dynamic dispatch in places where a static dispatch is applied. For example instead of
<H: Hasher>
we'll use<&dyn Hasher>
, supposedly it should reduce compile times and generally it is better to use this in binaries (vs. libraries). A lot of this stuff is based on some readings I've done over the course of my rust experience, nothing was actually tested by me personally.
@oren0e Thanks for your suggestions! We'd love to check this out. If you're willing it'd be great to test and see if it benefits compile time and then consider doing the changes.
@aviramha would like to take a stab at this in case nobody else is working on it
@abhirag Awesome! Let us know if we can help in any way :)
Thanks @abhirag for opening the issues, adding it at the original post so we can track (feel free to suggest more everyone :))