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
Enable LTO building on supported platforms by default #13192
Conversation
Results so far testing the CI: Docker image builds fine. It is notable that those CIs that create release builds also sometimes build the some dependencies. Here it would likely make sense to ensure that LTO is enabled for these too by modifying the build environment. |
@tamara-schmitz If you send a new commit, it should run CI again. If you want to keep commit history clean, you could force push a new commit with the same changes and that should work as well. (Unfortunately, I don't think you can get CI to run again otherwise.) |
Do you happen to have to performance test numbers? I'm curious about the magnitude of possible improvements. |
@lhofhansl No concrete numbers, but I am getting constant 60FPS now when it dropped below slightly before compiling in LTO, which is really nice since it means the CPU gets to sleep a lot more. Also, it turns out that someone with write access to the repository can go to https://github.com/minetest/minetest/actions/runs/4118472326 and re-run CI: https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs |
Sounds useful to me, though we should test this to make sure it doesn't expose unforeseen bugs. Try force-pushing to rerun the pipelines. |
fb85ab6
to
f44a83e
Compare
I have marked the tasks as complete since someone already ran these builds locally. |
@tamara-schmitz is this still WIP? |
ready for merging imo. but im not a maintainer |
Do we need an extra option to disable this or does cmake already provide one? |
is a good idea to add that. gonna revise the patch |
@tamara-schmitz Are you still interested in this PR?
I also quickly checked the answer for this. There seems to be none. |
btw. default release builds should be definitely done with LTO. CI runs & stuff is not that great idea, because linking is much more expensive (and in case it's done, at least Mold or other performant linkers should be used). |
Seems to be abandoned. |
While there was a PR before that made LTO builds possible, it was not enabled by default. Why not try flip the switch for release builds?
Link Time Optimization or Interprocedural Optimization is a build time optimisation gives the compiler information about how the individual source code files will be linked. This generally leads to a speed up for most C/C++ programs. This feature is enabled on a lot of major software projects as well as Linux distributions.
A good technical optimisation of how LTO works can be found here: https://www.llvm.org/docs/LinkTimeOptimization.html
Understandably it is still possible that one could run into issues here. If we do encounter them, then this PR can include fixes for broken code. If a build environment does not support LTO, the feature still remains off.
My proposal is to just merge this PR once it has been tested somewhat and if users do come back with issues, revert the PR and fix the issues.
To do
This PR is a Work in Progress.
How to test
Apply the change and build locally / in your buildsystem, or grab builds from the CI artifacts.