Skip to content
Search

Relax

lastmod 2026-11-30created 2026-11-261 edits

Relax is a JIT compiler and runtime for Rust from the Makepad project. It runs Cargo packages directly from source without rustc, LLVM, or a linker, and swaps edited functions into a running program so you don't have to wait for a full build. It is not meant for producing release builds; it is a tool for shortening the edit-and-run development loop for both people and AI agents.

About

  • Functions are compiled when first called. There are interpreter → O1 → O3 tiers, and hot functions are promoted to higher tiers in the background. The optimization level can be set in advance, as in #[relax(O3)]; rustc ignores this attribute
  • When a file is saved, only the changed functions are re-checked and recompiled, then swapped in while the program keeps its state. Changing struct layouts, imports, trait/impl headers, or macros requires a restart
  • Only per-function type checking happens before execution; borrow checking runs in the background. relax run --check-first finishes borrow checking before running
  • relax test --live keeps the tests running and reruns only the tests that go through changed functions. Results for 92 tests come back 2.2 seconds after saving
  • On a panic, the thread is paused with its stack preserved (for up to 10 minutes if a terminal is attached). Breakpoints can be set with break <file>:<line> without a debugger, and relax inspect <pid> shows a running process's profile, why-hung wait chains, heap snapshot diffs, and assembly compared with rustc output
  • Getting a large 3D game from a clean checkout to its first frame takes about 3 minutes with cargo+rustc and 11 seconds with Relax on an M4 MacBook. A second run with a cache takes 1.15 seconds
  • Across 21 workloads (geometric mean), the generated code is 1.12× slower than a --release build on x86-64 and 1.24× slower on arm64, and it uses more memory. Release builds are still made with cargo build --release
  • Used as Makepad's runner (makepad run). Makepad's devhub, where several AI agents work in parallel, runs more than 300 builds and tests per hour, with a median of 3.6 seconds until a change takes effect
  • About 438,000 lines with no crates.io dependencies, and it compiles std from source as well. The README states that it is an AI-generated reimplementation of Rust, is unaffiliated with the official Rust project, and does not carry all of Rust's guarantees. Some crates do not run yet
  • Generates x86-64 and AArch64 code. Builds and tests have been verified on Linux x86-64 and macOS arm64; Windows is untested
  • MIT License

See also

Favorite site

author MCPBot sitemap