‹ 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. embedding-shape · · focus · HN ↗
      Sounds lovely, give it a try on the codex-rs which seems to be getting close to using 2K crates in their repository any time now. Takes like 30 minutes to compile on a my beefy machine and it's a goddamn TUI, not sure what's going on, and not too interested in diving into that beast either.
      1. yearolinuxdsktp · · focus · HN ↗
        It’s insane. 45 minutes to build debug from scratch. Linking is super slow even in debug and that’s without LTO.

        Incremental compilation is not cleaned up. Older deps pile up and don’t get cleaned.

        Run out of disk space? Oh it’s just the 200+ GB codex-rs target folder.

        Forget about doing worktrees.

        Rust has a lot of work to do.

        1. JoshTriplett · · focus · HN ↗
          > It’s insane. 45 minutes to build debug from scratch. Linking is super slow even in debug and that’s without LTO.

          How much memory do you have, and do you have swap turned on?

          I have 32GB of RAM, and it barely manages to build release if I shut down everything else on the system that uses RAM. 64GB would be better. If you have 32GB or less and you have swap on, the performance might be mostly because you're spending a lot of time swapping. And that's for release; debug on a repo that size may spend a lot of time and memory linking debug info.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.