firecracker
firecracker copied to clipboard
Add codegen-units=1
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.
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.
We closed the [initial PR](We will close the PR and resume work on this when we have bandwidth.) and resume work later.
PR: https://github.com/firecracker-microvm/firecracker/pull/4218