Unofficial Hacker News companion — get notified on comment replies, and more.

Optimizing Rustc's next trait solver (opens external site)

213 points by g0xA52A2A 6 days ago | donsz.nl | 48 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (2)

  1. serde, crossbeam, and rand all involve generics so you may be getting a decent amount more code than 4k lines after macro expansion (aka #[derive(Serialize, Hash)) and generic instantiation.

    you might also be able to drop crossbeam for stdlib types and rand for much smaller random library if you don't need it's comprehensive features.

    cargo's release profile also uses opt level 3 and thin-local lto by default. Whether you need those is up to you, hard to say more without knowing your project!

    but yes it is somewhat easy to allow rust projects to creep up in compile times especially with how easy it is to bring in big useful libraries that often come with a lot of features. disabling features where possible is the go to if you have big dependencies.

    Replies (1)
    1. Thanks for the suggestions, I'll look into replacing rand maybe.

      I don't depend on serde, I tried to find an alternative to serde-json but couldn't find anything.

      I like crossbeam a lot because it is multi consumer which means I can build a "work stealing" thread pool very easily.

      It seems like the majority of the time is taken by the linking.