Skip to content
astral-experimentsPublic

About

An experimental fork of the Rust toolchain, designed for fast, highly parallel local development.

Resources

Contributing

Security policy

Stars

14 stars

Watchers

0 watching

Forks

Repository files navigation

Ohm

CI License

An experimental fork of the Rust toolchain, designed for fast, highly parallel local development.

Comparing Ohm 1.99.0-27 to upstream Rust, end-to-end development is around 1.82× faster:

Scope Rust 1.99.0 Ohm Time saved
Ruff session 401.80 s 221.08 s 44.98%
uv session 137.37 s 78.94 s 42.54%
Codex session 511.62 s 268.48 s 47.52%
ty session 283.31 s 164.41 s 41.97%
All sessions 1,334.09 s 732.91 s 45.06%
cargo check 142.39 s 47.26 s 66.81%
cargo test, cargo nextest, just test 760.43 s 516.41 s 32.09%
cargo clippy 388.13 s 140.64 s 63.76%
cargo fmt 13.77 s 8.62 s 37.43%
Other commands 27.38 s 17.47 s 36.19%
All commands 1,332.11 s 730.40 s 45.17%

And disk usage (on APFS) decreases by around 55%:

Scope Rust 1.99.0 Ohm 1.99.0-11 Space saved
Ruff/ty session 5.82 GiB 3.49 GiB 40.06%
Ruff/ty, 2 worktrees 10.07 GiB 5.91 GiB 41.25%
Ruff/ty, 10 worktrees 52.98 GiB 26.46 GiB 50.05%
uv session 12.09 GiB 7.76 GiB 35.83%
uv, 2 worktrees 16.25 GiB 8.55 GiB 47.37%
uv, 10 worktrees 79.41 GiB 32.31 GiB 59.31%

Compared to upstream, Ohm:

  • Enables (by default) existing experimental features (e.g., parallel compiler frontends).
  • Implements experimental, performance-oriented features proposed upstream (e.g., Relink, don't rebuild).
  • Fixes various performance bugs and regressions (e.g., around target/ size increases).
  • Implements additional optimizations identified by Codex (e.g., reusing build artifacts between cargo build and cargo check, avoiding rustfmt on unchanged files).

Warning: Ohm includes backported and experimental Rust, Cargo, and Clippy optimizations that may be unsound. This README is human-edited, but all code changes, PR summaries, and additional documentation were authored entirely by GPT in Codex.

Installation

Ohm supports Apple Silicon macOS and x86_64 Linux. Install rustup, then install the latest Ohm release with our standalone installer:

curl --proto '=https' --tlsv1.2 -LsSf \
  https://labs.astral.sh/ohm/install.sh | sh

Ohm's installer verifies its embedded archive checksum, installs the complete Rust toolchain, and registers an exact version and a moving ohm alias with rustup, enabling cargo +ohm invocations (e.g., cargo +ohm check).

To install an exact version:

curl --proto '=https' --tlsv1.2 -LsSf \
  https://labs.astral.sh/ohm/releases/ohm-1.99.0-9/install.sh | sh

Each Ohm release targets a specific upstream Rust release. When a Rust version becomes available, we replay the optimizations that remain relevant and drop those that have already landed upstream. Multiple Ohm revisions may target the same Rust release; for example, ohm-1.97.1-20 and ohm-1.97.1-21.

Usage

Use rustup's +toolchain syntax to select Ohm:

cargo +ohm test
cargo +ohm check
cargo +ohm clippy
cargo +ohm fmt

Exact toolchain names have the form ohm-<rust-version>-<ohm-revision>. For example, cargo +ohm-1.99.0-9 test selects that installed revision.

Ohm enables dependency-aware rebuild reduction, cached relinking, parallel compiler frontends, and reuse of previously built registry and workspace dependencies by default. Opt out with -Zohm-defaults=no:

cargo +ohm -Zohm-defaults=no test

Run Ohm's garbage collector from any directory to clean up unused build artifacts in idle worktrees and shared caches.

cargo +ohm gc

AGENTS.md

To teach Codex about Ohm, consider adding the following to your ~/.codex/AGENTS.md:

## Ohm Rust toolchain

- Use `cargo +ohm <command>` for all local Cargo commands, including `check`, `test`, `clippy`,
  `fmt`, `metadata`, and external subcommands. Use `rustc +ohm` for direct compiler calls and
  `RUSTUP_TOOLCHAIN=ohm just <recipe>` for task runners.
- Ohm automatically enables `-Zrelink-only`, `-Zpublic-api-hash`, and `-Zthreads=8` when compiling.
  Cargo supplies these flags for you. Direct `rustc +ohm` uses its own defaults.
- Keep a stable, distinct `CARGO_TARGET_DIR` for each worktree. Set `CARGO_BUILD_BUILD_DIR` to a
  separate shared path for all trusted local projects and worktrees using the same Ohm toolchain.
  Keep the shared build directory separate from every worktree target directory, and do not delete
  it when cleaning up an individual project or worktree.
- Create worktrees for local Rust development from an existing Cargo workspace with
  `cargo +ohm worktree add -b <branch> <path> <base>` to seed reusable build state automatically. If
  using custom target directories, pass the new worktree's target directory via `--target-dir`.
- Set `CARGO_UNSTABLE_OHM_PROC_MACRO_TRUST=all` to maximize authenticated registry procedural-macro
  reuse across worktrees. On `cargo +ohm worktree add`, this also opts into importing snapshots
  containing local procedural macros. This opt-in is potentially unsound; avoid it for CI, releases,
  etc.
- Set `CARGO_UNSTABLE_OHM_NATIVE_TOOL_TRUST=all` to maximize reuse of authenticated registry build
  scripts and native-tool helpers across worktrees. This opt-in is potentially unsound; avoid it for
  CI, releases, etc.
- Use `cargo +ohm -Zohm-defaults=no <command>` to disable Ohm's automatic experimental defaults. Use
  plain `cargo <command>` and the repository's normal toolchain for CI and production builds.

Philosophy

Rust's compile times and disk usage are emerging as bottlenecks in day-to-day development, especially as agents enable us to parallelize across (dozens of) worktrees.

Ohm enables experimental optimizations to improve Rust's iteration speed and throughput. This is a deliberate tradeoff: we accept the risks of experimental implementations in local development, where the blast radius of bugs is comparatively limited and the benefits of faster iteration are substantial (while continuing to use the official toolchain for production builds).

Ohm is authored entirely by the GPT model series in Codex. Agents lower the cost of implementing, testing, and refining ideas. When an optimization proves useful, we can propose it upstream. To keep that path open, Ohm avoids fundamental changes to the Rust toolchain, such as introducing a stateful development server.

For details on the optimizations Ohm enables and their measured impact, see Optimizations.

Ohm's patches are maintained in the following repositories:

Benchmarks

See the benchmark guide for details.

Project Workflow Rust 1.99.0 Ohm 1.99.0-27 Time saved
Ruff/ty Edit → focused test 13.87 s 14.84 s −7.01%
Ruff/ty Edit dependency → downstream test 13.99 s 12.24 s 12.52%
Ruff/ty Edit → check → test → check 20.45 s 22.35 s −9.27%
Ruff/ty Check → build → check 76.39 s 50.36 s 34.08%
Ruff/ty Edit → fmt → clippy → test 27.03 s 22.85 s 15.46%
uv Edit → focused test 19.13 s 8.90 s 53.48%
uv Edit dependency → downstream test 20.94 s 2.39 s 88.60%
uv Edit → check → test → check 21.67 s 11.10 s 48.78%
uv Check → build → check 116.28 s 60.78 s 47.73%
uv Edit → fmt → clippy → test 24.77 s 12.85 s 48.12%
Codex Edit → focused test 27.06 s 25.63 s 5.31%
Codex Edit dependency → downstream test 50.67 s 3.55 s 92.99%
Codex Edit → check → test → check 33.48 s 31.97 s 4.51%
Codex Check → build → check 156.80 s 109.03 s 30.46%
Codex Edit → fmt → clippy → test 36.63 s 31.29 s 14.57%

Direct edits modify the crate being checked, linted, or tested:

Project Workflow Edited crate Rust 1.99.0 Ohm 1.99.0-27 Speedup
uv cargo check uv 1.99 s 1.77 s 1.12×
uv cargo clippy uv 3.29 s 2.52 s 1.31×
uv cargo test --test it uv 18.07 s 7.96 s 2.27×
Codex cargo check codex-core 4.43 s 4.12 s 1.08×
Codex just clippy codex-core 19.98 s 13.24 s 1.51×
Codex just test codex-core 27.81 s 26.60 s 1.05×

Indirect edits modify a dependency's implementation without changing its public API, so Ohm can avoid rebuilding unchanged dependents:

Project Workflow Edited dependency Rust 1.99.0 Ohm 1.99.0-27 Speedup
uv cargo check uv-normalize 8.79 s 0.50 s 17.51×
uv cargo clippy uv-normalize 12.94 s 0.62 s 21.02×
uv cargo test --test it uv-normalize 19.53 s 2.21 s 8.84×
Codex cargo check codex-utils-string 18.03 s 0.88 s 20.51×
Codex just clippy codex-utils-string 40.32 s 1.13 s 35.65×
Codex just test codex-utils-string 50.62 s 3.03 s 16.70×

Other common cases include build-to-check reuse, formatting, and worktree startup:

Project Workflow Package Rust 1.99.0 Ohm Speedup
uv Check after build uv 59.92 s 11.91 s 5.03×
uv Shared-worktree build uv-normalize 6.75 s 0.73 s 9.24×
Codex Check after build codex-core 106.43 s 27.54 s 3.86×
Codex No-op formatting Workspace 9.90 s 0.17 s 57.71×
Codex Formatting after an edit codex-core 9.53 s 0.28 s 34.21×
Codex Shared-worktree build codex-utils-string 2.74 s 0.66 s 4.16×
ty Worktree startup (ext4) ty_python_semantic 92.94 s 53.59 s 1.73×
ty Worktree startup (Btrfs) ty_python_semantic 98.19 s 51.38 s 1.91×
Ruff Doctests Selected crates 13.564 s 1.740 s 7.80×

License

Ohm is licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Ohm by you, as defined in the Apache-2.0 license, shall be dually licensed as above, without any additional terms or conditions.

About

An experimental fork of the Rust toolchain, designed for fast, highly parallel local development.

Resources

Contributing

Security policy

Stars

14 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages