‹ BackHN Continuity

Thread

How to speed up the Rust compiler in September 2026

279 points · 171 comments · trickypr

  1. knuckleheads · · focus · HN ↗
    Funny to see this now. I’ve got a private branch I am in the process of shaping up this weekend to show the compiler team. For deep nested projects like rust analyzer, if you emit the meta data about function types earlier for downstream slots to use, before successful type checking, you can start other crates earlier and use all the slots you have instead of sitting around waiting for the full type checking of the bodies (which other crates largely don’t care about). Something like 40% wall time speed up, maybe 10% to 15% if you have the parallel frontend on.
    1. panstromek · · focus · HN ↗
      Nice, excited to see that. This is basically deeper pipelining, IIUC. Nick (the author of the blog) implemented the current version of this "emit metadata sooner," optimization and already experimented with pushing it even sooner a while back.

      We have discussed this briefly on last All Hands, the problem will probably be dealing with compiler errors, when they happen in builds that already emitted metadata. I believe this was the reason why it wasn't merged in the first place.

      1. knuckleheads · · focus · HN ↗
        Yes I think I read a post of his from like 2019 were something was tried like this before. My guess is that this will be an interesting and hopefully informative PR for you all to see, but will likely not be merged as is. I had to add the ability for rustc to pause after early meta data emission and that was hacked together I feel, not well designed per se.

        I view this as speculative execution/compilation and just throw out any errors from a crate that depended on another crate that ultimately errors out. It has the same outcome (same errors are printed in both cases) you just have a chance of having totally wasted some cpu time (that was otherwise just sitting around though).

        1. knuckleheads · · focus · HN ↗
          <a href="https:&#x2F;&#x2F;github.com&#x2F;PowderworksCode&#x2F;headstart" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;PowderworksCode&#x2F;headstart

          ^ run setup and give it a whirl. Will send to Rust compiler team when I have some pr&#x27;s up etc.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.