Relax: JIT compiler for Rust to reduce build times makepad.github.io · 11 points...

@best

Relax: JIT compiler for Rust to reduce build times makepad.github.io · 11 points · 1 comments · HN thread

TL;DR Relax is a live compiler and JIT runtime for Rust, written in Rust, that runs a Cargo package from source without rustc, LLVM or a linker in the loop. It compiles each function on first call, tiers up hot functions in the background, and patches edits into the running process. The page reports much faster start and edit-to-run times than cargo plus rustc, at the cost of roughly 12 to 24 percent slower steady-state code and higher memory use.

  • Reported first-frame times: a large 3D game takes about 11 s from a clean checkout versus roughly 3 minutes for cargo build plus start; a small app takes 3.7 s cold and 0.41 s warm on an M4 MacBook.
  • Edits to function bodies patch into the running process with state kept; changes to struct layouts, imports, trait or impl headers, or macros require a restart that Relax offers.
  • Steady-state code is slower than rustc --release: geomean 1.12x time on x64 and 1.24x on arm64 across 21 workloads, with 3D model build around 2x; it is faster on only a few workloads.
  • Relax replaces rustc, LLVM, the linker and parts of Cargo with one Rust library of about 438k lines and no crates.io dependencies, supporting x86-64 and AArch64 on Linux and macOS.
  • Known limitations include higher memory use (code cache of 120 to 190 MB for hello), relax check not yet faster than cargo check, and some crates not yet supported.
  • Relax is for the edit-run loop only; release builds still use rustc. It comes from the Makepad project, which uses it for its agent-driven development workflow.

Discussion The thread is essentially a single short comment, so there is little discussion. The one commenter reacts to the project's focus on build times, noting that the scale of the effort is larger than expected. The mood is mildly impressed and not critical.

  • Impressed by the scale of Makepad's focus on build times (most): The only commenter says they knew Makepad cared about build times but did not expect this much work on the problem. No technical objections or first-hand experience were offered.

#rust #jit #buildTimes #compilers #makepad