mirrord icon indicating copy to clipboard operation
mirrord copied to clipboard

Reduce compile time

Open aviramha opened this issue 2 years ago • 7 comments

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

aviramha avatar May 31 '22 10:05 aviramha

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 avatar Jun 16 '22 19:06 jo3bingham

@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.

aviramha avatar Jun 17 '22 04:06 aviramha

I have two thoughts on this:

  1. 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 the error.rs files could be implemented by hand?
  2. 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 avatar Jun 30 '22 18:06 oren0e

@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 avatar Jun 30 '22 19:06 aviramha

@aviramha would like to take a stab at this in case nobody else is working on it

abhirag avatar Jul 25 '22 07:07 abhirag

@abhirag Awesome! Let us know if we can help in any way :)

aviramha avatar Jul 25 '22 07:07 aviramha

Thanks @abhirag for opening the issues, adding it at the original post so we can track (feel free to suggest more everyone :))

aviramha avatar Jul 28 '22 10:07 aviramha