Codex tip: setting codegen-units=1 makes Rust PGO instrumented builds >90% faster

charliermarsh · x · 2026-10-08

Ruff author Charlie Marsh shares a Codex-suggested Rust build optimization: dropping codegen-units to 1 sacrifices within-crate parallelism but substantially cuts total work — especially in the fat-LTO step, since there's less intermediate code, profiling data, and retained function bodies to process.

PGO amplifies the win: the instrumented build got >90% faster, and the final non-instrumented build also sped up, though less dramatically.

Related event: uv author: codegen-units=1 speeds builds 50%, cuts memory 67%(4 posts)→

Original post →

More from coding & agent

coding & agent channel →