You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider "codegen-units = 1" optimization for the Release profile in Codex Rust #1411
I see that the project already uses FatLTO in the Release profile. Additionally, I suggest enabling the codegen-units = 1(CG1) optimization too. Enabling more advanced optimizations allows us to reduce the binary size further (always a good thing) and improve the application performance even more. Especially since you care about the binary size.
Basically, it can be enabled with the following change:
[profile.release]
codegen-units = 1
...
I have made quick local tests (AMD Ryzen 9 5900x, Fedora 42, Rust 1.88, the latest version of this project at the moment, cargo build --release --all-features --all-targets command from the CI script) - the results are below.
Build config \ Binary name
codex
codex-tui
codex-exec
codex-execpolicy
codex-file-search
codex-linux-sandbox
codex-mcp-client
codex-mcp-server
FatLTO
17 Mib
15 Mib
11 Mib
7.7 Mib
3 Mib
870 Kib
3.6 Mib
8.1 Mib
FatLTO + CG1
16 Mib
14 Mib
9.5 Mib
6.8 Mib
2.9 Mib
828 Kib
3.3 Mib
7.6 Mib
Clean build time was even reduced from 2m 45s to 2m 15s.
Activity
fix: build with `codegen-units = 1` for profile.release (#1421)
bolinfest commentedon Jun 28, 2025
@zamazan4ik Thanks for the detailed suggestion with all the references! Just added this in #1421.
fix: build with `codegen-units = 1` for profile.release (openai#1421)
fix: build with `codegen-units = 1` for profile.release (openai#1421)
fix: build with `codegen-units = 1` for profile.release (openai#1421)
codex: relax codegen-units alongside LTO
fix: build with `codegen-units = 1` for profile.release (#1421)
fix: build with `codegen-units = 1` for profile.release (openai#1421)