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

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

213 points by g0xA52A2A 7 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. I have a rust genomics pipeline where I was seeing a 3 minute “incremental” build that was entirely spent on trait resolution. I did some -Zself-profile analysis and saw the type checker spending >50% of its time re-deriving the same set of obligations over and over (due to a single blanket impl with a stack of associated type). I wasn’t sure if the problem was that it was missing a memoization cache or that it was just searching poorly.

    This is a great way to describe the “lazy” nature of the new solver.

    Are there any benchmarks that include pathological cases of blanket implementations? (It is easy to run into this if you are writing generic numeric code – as I do for a living in bioinformatics)

    Replies (1)
    1. Were you seeing slow trait resolution times with the old or new solver? If the latter I think you're more likely to get a dev response if you open an issue [0] with more details than posting here.

      [0]: https://github.com/rust-lang/rust/issues