· javascript

How to speed up the Rust compiler in November 2026

My first month working on Rust compiler performance for Hexcat is over and it’s time to see some of what’s happened since my last post.


Spans are a critical data structure in the Rust compiler. Every AST, HIR, and MIR node carries a span. Each span has four fields recording the following.

Each of the four fields is 32 bits, resulting in 16 bytes of data. But most of the time these 16 bytes can be compressed into one of three 8-byte inline formats, and the remaining cases are interned into a global table. This works by taking advantage of patterns in the data: many source locations have a small length (i.e. a small difference between lo and hi); many spans have a zero context and/or parent, and the non-zero contexts and parents are typically small integers; parents are only used in incremental builds. #163857: In this PR I replace the old compression scheme with one that is simpler and more efficient.

For incremental builds we now typically intern around 1% of spans compared to 20-40% with the old scheme. (In non-incremental builds we typically intern fewer than 0.1%.)

Related coverage

Also worth reading

  1. TypeScript scode-typescript/v1.0.2 released, bundling TypeScript 7.0.2
  2. angular 22.3.0-next.4 released
  3. September in Servo: progress, rounded rectangles, and more
  4. 'Stop dirty datacenters': Europe-wide protests planned demanding building moratorium
  5. Anthropic won't fix a Claude Dispatch flaw that could let attackers execute remote commands across corporate boundaries