Hacker News AI · 2026/10/20 23:50:29
ra-jit 发布 Rust 即时编译工具 提速 24 倍
开源项目 ra-jit 推出基于 rust-analyzer 的即时编译技术,实现保存文件后毫秒级热更新运行中程序。该工具通过增量重编仅修改函数,将单次编辑构建时间从 169ms 降至 7ms,提升约 24 倍,但暂不支持借用检查且仅限 Apple Silicon 实时预览。
报道全文原始报道全文
本文目录6 个章节
ra-jit
Edit Rust. See it change in milliseconds, in the program that is already running.
nix run github:indexable-inc/ra-jitThat opens a Game of Life window you can edit while it runs (live on macOS Apple silicon).

For release news: Watch → Custom → Releases on GitHub.
What you get
- Live edits. Save a file and the running program has the new code about a millisecond later. Its state stays. (docs/live.md)
- Fast builds. After the first build, an edit rebuilds only the functions you changed.
No
rustc, no waiting. - Same cargo.
cargo ra-jit build|run|test|checkin any project.
How fast
Live edit to running code, Game of Life demo (median of 20 edits, one 96-core Linux machine):
| Edit | incremental cargo build | ra-jit live | |
|---|---|---|---|
| One function | 169 ms | 7 ms | 24x |
| One function, 300 new functions added | 282 ms | 60 ms | 4.7x |
Edit, then build (generated 200-crate workspace, Linux x86-64, 8 CPUs, both warm and incremental, same linker, median of three):
| Edit | cargo | ra-jit | |
|---|---|---|---|
| A function in the main crate | 1.76 s | 0.42 s | 4.2x |
| A function in a crate everything depends on | 6.33 s | 0.60 s | 10.6x |
| Functions in 30 crates at once | 6.26 s | 0.62 s | 10.1x |
| A new function | 2.09 s | 0.56 s | 3.7x |
| A signature used in every crate | 13.87 s | 10.87 s | 1.3x |
Not measured yet: real projects, and a build from nothing against a fresh cargo build
(#benchmarks).
Try it on your project
nix run github:indexable-inc/ra-jit#ra-jit -- buildNo nix? cargo +1.99.0 install --locked ra-jit, or put the binaries from a
release on your PATH. Then use Rust
1.99.0 with its source:
rustup toolchain install 1.99.0 -c rust-src && rustup override set 1.99.0.
Use it as your normal cargo build
nix profile install github:indexable-inc/ra-jit#ra-jit
ra-jit enableFrom then on plain cargo build, run, test and check in any project go through ra-jit.
ra-jit disable puts your cargo config back.
Live edits
Add the crate and poll once per frame:
ra-jit-live = "0.1"let mut live = ra_jit_live::Live::start().ok();
loop {
if let Some(outcome) = live.as_mut().and_then(|it| it.poll()) {
eprintln!("ra-jit: {outcome}");
}
// ...your frame
}What to know
- Live edits work on macOS Apple silicon only. Elsewhere you still get fast builds.
- No borrow checker: keep running
cargo check. - Rust 1.99.0 only.
- Changing a struct the program is using asks for a restart.
More: how it works, full results, what is supported.