← Thu, Nov 12 digest

Relax: JIT compiler for Rust to reduce build times

read article ↗ hn thread ↗

Relax is a new JIT compiler and live runtime for Rust that eliminates rustc, LLVM, and linkers to drastically speed up development iteration loops.

read it Read this to understand how a complete custom Rust JIT compiler bypasses LLVM and cargo to achieve sub-second code hot-patching.

summary

Relax is a custom JIT compiler and runtime for Rust designed to bypass rustc, LLVM, and the system linker to accelerate local development loops. Written completely in Rust with zero external dependencies, it compiles functions lazily on first call and hot-patches file changes into running processes while preserving state. While it cuts build and test-run times drastically, code execution is slightly slower than LLVM output, and structural changes require restarts. The project was rapidly prototyped using AI coding agents to solve iteration bottlenecks for parallel development workflows.

key points

  1. Replaces rustc, LLVM, Cargo, and the linker with a single 438k-line Rust library that compiles code lazily function-by-function.
  2. Delivers sub-second hot-patching and rapid test loops, though steady-state code execution runs 12 to 24 percent slower than stock release builds.
  3. Built almost entirely with AI coding assistants over a month to support high-speed AI agent and human development workflows.

who should read it

Rust developers and systems engineers interested in alternative compilation architectures, hot-reloading, and fast iteration workflows.

discussion warm

consensus

Commenters are fascinated by how AI coding agents enabled the rapid creation of complex compiler tooling, drawing parallels to historical Lisp environments.

pushback

Some critics question the long-term maintainability of a massive custom codebase and the trade-offs of shifting checks to runtime.

best comment by pcwalton ↗

Yeah, this is pretty much a textbook example of what AI agents make possible these days: things that are ridiculously ambitious, but aren't conceptually very difficult (or, at least, are conceptually well-trodden ground). Things like emulators, language runtimes, platform reimplementations like Darling, etc.

JITting Rust isn't conceptually very hard: you just take rustc and make everything dynamic instead of static. The only thing that was stopping it before was the sheer amount of effort. Well, now we have a way to reduce that effort.

It explains why AI agents are uniquely suited for building ambitious, conceptually well-trodden systems like custom language runtimes.

Generated by an LLM from the article and thread. Check the sources before relying on it.