Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using lto="thin" #364

Open
ultrabear opened this issue Aug 9, 2023 · 1 comment
Open

Consider using lto="thin" #364

ultrabear opened this issue Aug 9, 2023 · 1 comment

Comments

@ultrabear
Copy link

Hi, I've just installed this project (through cargo install) and noticed the build was taking impressively long, I tracked this back to FatLTO being enabled (build with FatLTO takes 3m24s, while a modified Cargo.toml specifying lto="thin" takes merely 1m21s, shaving over 2 minutes off building on my machine (6c12t ryzen 2600)).

Is there any reason FatLTO is chosen over ThinLTO? Thin produces similar results (FatLTO binary is 14mb, while Thin is 19mb, this is negligible to most people) and takes a third of the time to build, which was very noticeable when I installed the project.

(worth noting no LTO takes 20mb, and surprisingly 1m25s on my machine, this is probably due to noise however)

@ultrabear
Copy link
Author

ultrabear commented Aug 10, 2023

I did some additional testing with the knowledge that ThinLTO splitting is dependent on codegen-units.

Setting codegen-units = 2 with lto = "thin" results in a 17mb binary and takes 2m8s on my machine to cleanbuild. This is a better tradeoff than ThinLTO with the default codegen-unit split of 16, and is only 3mb more than FatLTO, while taking a minute less to build.

Reducing the codegen-unit count also allows more optimizations, so it is desirable if you want to speed up the program further.

Other tests:
codegen-units = 4, lto = "thin": built in 1m20s, 18mb binary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant