Rust tip: codegen-units = 1 makes uv build 50% faster with 67% less memory

charliermarsh · x · 2026-10-08

uv author Charlie Marsh shares a counterintuitive Rust build optimization: setting codegen-units = 1 made the uv build 50% faster, cut peak memory by 67%, and shrank the binary by 17% — surprising since more codegen units usually improve build times.

He adds that PGO amplifies the effect: the instrumented binary build became >90% faster, and the final non-instrumented build also got faster, though less dramatically.

Related event: Setting codegen-units=1 Speeds Up uv Builds by 50%, Cuts Memory 67%(3 posts)→

Original post →

More from coding & agent

coding & agent channel →