firecracker icon indicating copy to clipboard operation
firecracker copied to clipboard

Add codegen-units=1

Open gbionescu opened this issue 3 years ago • 2 comments

During the 0.25 release we've noticed a significant variation in the binary size, where simply changing the firecracker version would add 15kb to the binary size.

Later investigation showed that LTO was at fault for this change in size - simply disabling the LTO would produce consistent binaries. Further reading the cargo reference manual on lto shows that No LTO is performed if codegen units is 1 or opt-level is 0.. Testing without LTO indeed produces consistent binaries and as a bonus, smaller ones - the v0.25 one is 0.5 mb smaller.

Also, in the context of a previously opened PR by @KarthikNedunchezhiyan here, I propose that we add codegen-units=1 to the release profile to prevent variations such as this one.

gbionescu avatar Aug 13 '21 12:08 gbionescu

This PR is affected by the same thing: https://github.com/firecracker-microvm/firecracker/pull/2661. Even though it gets rid of a ton of code, the binary gets larger.

alindima avatar Aug 13 '21 12:08 alindima

We closed the [initial PR](We will close the PR and resume work on this when we have bandwidth.) and resume work later.

dianpopa avatar Oct 29 '21 12:10 dianpopa

PR: https://github.com/firecracker-microvm/firecracker/pull/4218

JonathanWoollett-Light avatar Nov 07 '23 10:11 JonathanWoollett-Light