Enable Link-Time Optimization (LTO) and codegen-units = 1 for Release builds
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- build-system
Research direction
The change belongs in the root Cargo.toml, under the [profile.release] table (add it if missing). Set codegen-units = 1 and lto = true there, and leave the dev profile alone. Run cargo build --release to confirm it builds and compare the binary size against the baseline; the issue reports 10.7 MiB before and 7.6 MiB after. Check the existing CI workflows, since they will pick up the new profile automatically, and note that release builds get slower.
Written by the indexing model from the issue text.
Description
Hi!
I noticed that in the Cargo.toml file Link-Time Optimization (LTO) for the project is not enabled. I suggest switching it on since it will reduce the binary size (always a good thing to have) and will likely improve CPU performance a bit due to more aggressive compiler optimizations. Additionally, codegen-units = 1 (CU1) option can help too in a similar to LTO way, so I recommend to enable it as well.
I recommend enabling LTO only for Release builds so developers experience won't be affected by the increased build time. Actually, I can propose to use flags directly from this ripgrep profile (like stripping and other things).
Basically, it can be enabled with the following lines to the root Cargo.toml file:
[profile.release]
codegen-units = 1
lto = true # FatLTO - the most aggressive LTO version
<possible other options like strip = true>
I have made quick tests (Macbook M1 Pro, macOS Tahoe 24.1, Rust 1.95, cargo build -r build command, without stripping) - here are the results:
- Current Release profile: 10.7 Mib, clean build time: 46s
- Release + FatLTO + CU1: 7.6 Mib, clean build time: 1m 32s
Build time increase shouldn't be a problem since we enable it only for the Release profile - in this case, we would not affect the development lifecycle. If the proposed settings are added to the Cargo.toml file, all binaries (including GitHub Actions-built and released binaries) will be built with the new options automatically.
Thank you.
- Dominant language
- Rust
- Stars
- 247
- Forks
- 30
- Avg merge
- 4d 19h
- Merged PRs (30d)
- 44
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from symposium-dev/symposium
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
symposium-dev/symposium#530 ·
Maintainers usually reply within 5 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
symposium-dev/symposium#406 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
symposium-dev/symposium#369 ·
Maintainers usually reply within 5 days
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
symposium-dev/symposium#531 ·
Maintainers usually reply within 5 days
-
ACP test setup leaks session settings into the test processPossibly taken @gmemuriuki claimed this 1 day ago. Openbug
symposium-dev/symposium#527 · 1 assignee ·
Maintainers usually reply within 5 days
All issues in symposium-dev/symposium
Similar issues
-
CI/CD ignore-for-release
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
eclipse-ankaios/ankaios#844 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
std: `SliceIndex<str>` missing for `std::ops` ranges, so generic `R: SliceIndex<str>` bounds failOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
topgrade-rs/topgrade#2540 ·
Maintainers usually reply within 1 day