增量 Rust 构建比 cargo/rustc 快多达 92 倍
Incremental rust builds up to 92x faster than cargo/rustc

原始链接: https://github.com/indexable-inc/blaze

Blaze 是一个 Rust 构建加速器,提供与 cargo 兼容的命令(`blaze run`、`test`、`build`)。在初次 cargo 构建之后,它将项目编译内容保存在内存中,仅重新编译已更改的函数,并修补现有二进制文件以实现毫秒级重建;选择启用的程序甚至可以在运行时更新。基准测试显示,在支持的平台上增量构建快约 5–20 倍。它支持 macOS(Apple Silicon)和 Linux,而 Windows 会回退到 cargo。Blaze 使用自己的 Rust 工具链,并以内存换取速度,因此最好与 cargo/CI 一起使用,以它们作为最终权威。它可通过脚本或 Nix 安装,包含一个生命游戏演示,并基于 rust-analyzer、Cranelift、LLVM 和 salsa 等工具。它以前称为 ra-jit。

一篇 Hacker News 帖子介绍了一款工具,声称增量 Rust 构建比 cargo/rustc 快最多 92 倍。评论指出基准测试结果:在 25 个基准测试中,中位数 19 倍、最低 3.7 倍、最高 83 倍。一位用户质疑“最多 92 倍”的说法,而另一位讨论了与 Google Blaze 的命名冲突和潜在的 Bazel 集成,提到 Rust 使用 -Z threads 的增量编译 bug。一条回复指出该工具并未公开,质疑冲突说法。
相关文章

原文

blaze

Rebuild Rust in milliseconds.

The same commands as cargo, with blaze in front.
Blazingly fast Rust, literally.

Install · Try it · How fast · How it works · Docs

curl -fsSL https://raw.githubusercontent.com/indexable-inc/blaze/main/install.sh | sh

For macOS on Apple silicon and Linux, with or without Rust installed: blaze downloads the Rust it builds with once (about 100 to 135 MB), or uses rustup's. Rather use crates.io or Nix? Other ways to install.

In any Rust project:

blaze run     # like cargo run
blaze test    # like cargo test
blaze build   # like cargo build

The first build runs cargo, then waits a few seconds for blaze to load your project. Then change a function and build again: it's back in milliseconds, and the Finished line says [ra-jit] (blaze's engine). Every other cargo command passes straight through to cargo. Where cargo is installed, cargo blaze run is the same as blaze run.

  • Edits rebuild 10× faster on macOS arm64, 24× faster on Linux aarch64 and 11× faster on Linux x86-64 than with cargo build, on average over real projects.
  • About 20 ms from saving a file to a running program using the new code, with live edits.
Edit one function, then build (Linux x86-64) cargo build cargo blaze build
ripgrep 508 ms 56 ms (9.1× faster)
nushell 1.25 s 236 ms (5.3× faster)
helix 2.15 s 116 ms (19× faster)
bun (1.25M lines of Rust) 9.11 s 451 ms (20× faster)

Every project, platform, chart, and the memory and disk it takes: benchmarks.

blaze runs beside cargo and keeps your project compiled in memory. After an edit it compiles only the functions you changed and writes them into the program cargo already built, instead of linking it again from scratch. A program that opts in can take the new code while it keeps running. More.

  • macOS on Apple silicon and Linux. On Windows every build is cargo's.
  • blaze is its own toolchain. It builds every project with its own Rust, blaze-2026-10-25 (today the nightly of that date), whatever the project pins; stable code and #![feature(...)] code build. Your toolchain and CI stay the final word (why).
  • It trades memory for speed: a few GB for a small project.
  • It's young. Keep cargo check or your CI as the final word, and tell us when something differs from cargo.

All the details: what works and what doesn't yet.

Demo: a Game of Life you can edit

nix run github:indexable-inc/blaze

This opens a Game of Life window. On macOS on Apple silicon you can change its rules, colours and speed while it runs; elsewhere the window runs without live edits. It needs Nix, and builds blaze from source the first time.

Editing the running Game of Life: rule, colours and speed change live

Tell us you use blaze

For release news: Watch → Custom → Releases on GitHub.

We're working with a few teams on fast Rust CI and remote builds, built on blaze. If your team waits on Rust builds, tell us what slows you down: [email protected]. Teams we work with get early access and a direct say in what we build next.

How to build blaze from a checkout, run its tests and send a change: docs/contributing.md. To report a security problem: SECURITY.md.

blaze stands on the shoulders of giants. Thank you to the people who built:

  • rust-analyzer, whose analysis and MIR blaze compiles from
  • Cranelift (Bytecode Alliance), the fast code generator
  • LLVM and inkwell, for the optimised tiers
  • salsa, the incremental engine underneath
  • object, for reading and writing executables
  • Rust and its compiler crates
  • rustd (DioxusLabs), whose code blaze includes

None of these projects endorses blaze.

blaze was called ra-jit until 2026-10-24; cargo ra-jit still works. Made at ix for den's native app. MIT or Apache-2.0.

联系我们 contact @ memedata.com