‹ 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. knuckleheads · · focus · HN ↗
        This thing is a monster, blows out the disk space on a Claude code web session. Will run it on my test server later and let you know.
        1. embedding-shape · · focus · HN ↗
          Now I want to test it too! Need any testers with Threadripper systems to really see what it can do? ;) Email in profile
          1. knuckleheads · · focus · HN ↗
            I will email you when I have something up for sure! First cargo check has it at about 28% reduced on codex rs, from 383 seconds down to 277 seconds on a 16 core machine. No -Zthreads yet though, and that typically has a similar effect and reduces the speed up the early meta data gives.
            1. knuckleheads · · focus · HN ↗
              Result:

              Headstart on codex-rs (16 cores, clean builds, median of 3 alternating off/on pairs):

                                        off       on     saved
                cargo check           383.8s   277.1s    28%
                cargo build           530.7s   330.8s    38%
                check, -Zthreads=8    220.0s   190.5s    13%
                build, -Zthreads=8    317.3s   249.2s    21%
              
              Not helpful for compilation yet, but it's something :)
              1. hensenjuang · · focus · HN ↗
                Do you see much benefit on incremental builds too, or is this mostly a clean-build win?
                1. knuckleheads · · focus · HN ↗
                  Depends on what you are editing I would say, if it's something deeper in the stack then it should help. The last numbers I have is that this is a 6-8% improvement for incremental editing of the code for cargo itself, but I'm having the benchmark be rerun now, as I've landed a fair amount of changes since then.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.