build: Enable LTO for release builds#6078
Conversation
Signed-off-by: Christian Menges <christian.menges@outlook.com>
|
Looks like we need to disable release mode for CentOS 7 compilation checks (although the reason for them is to confirm the code will compile and build) or extend the timeout for this action on every PR as it is taking > 30 minutes now.
Extending the timeout is probably best although we should also cancel all in progress jobs as part of it. Note that I would expect this PR requires a full build of all targets before it is merged: https://github.com/fluent/fluent-bit/blob/master/packaging/local-build-all.sh |
|
I did run local-build-all.sh and found the following issues:
Unfortunately, I can't run ARM builds, because the setup I have available does not support it. The behavior of CentOS 7 in the CI is strange. I couldn't reproduce such long build times. In other PRs, this CI run took around 6 minutes (e.g. https://github.com/fluent/fluent-bit/actions/runs/3082753214/jobs/4982838372). Therefore, I'm not sure whether this timeout was caused by the change or some problem with the CI runner. |
|
Thanks @Garfield96, yeah the CFL issue is already resolved but we've not updated the dependency here so that's a known problem I won't blame this PR for! :) |
Signed-off-by: Christian Menges <christian.menges@outlook.com>
Signed-off-by: Christian Menges <christian.menges@outlook.com>
d2f3d20 to
cb20c58
Compare
|
@patrick-stephens The CentOS 7 compile test is back to ~7 minutes execution time. Hence, this PR is ready for review/merge. |
Signed-off-by: Christian Menges <christian.menges@outlook.com>
|
@niedbalski I would highly appreciate it if you could have a look at this PR. Thanks. |
@Garfield96 I'll ask @niedbalski once he is back from holiday to take a look. |
* build: Enable LTO for release builds Signed-off-by: Christian Menges <christian.menges@outlook.com> * build: Disable LTO for gcc versions less than v8 Signed-off-by: Christian Menges <christian.menges@outlook.com> * build: Use gcc-8 for Ubuntu 18.04 Signed-off-by: Christian Menges <christian.menges@outlook.com> * Make IPO configurable Signed-off-by: Christian Menges <christian.menges@outlook.com> Signed-off-by: Christian Menges <christian.menges@outlook.com> Signed-off-by: root <root@sumit-acs.novalocal>
Signed-off-by: Christian Menges christian.menges@outlook.com
The CMake version upgrade (#6012) allows to enable LTO for release builds. As a result, the performance improves, as described in #4304. A downside of using LTO is an increased binary size as well as longer link times. However, in case of fluent-bit the binary bloat is neglectable (1-2Mb) and the increase of build time is only relevant for release builds. If link times become an issue in the future, we can consider to switch to the Mold linker, which is a modern and faster alternative to ld, ldd and gold.
Fixes: #4304
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.