Now that we have an upgraded build system for Windows, I am in the process of enabling LTO (link time optimizations) to the executables included with the installers. LTO offers a general improvement in performance of about 5-20% on average and is basically a ticket for better performance without any code changes. The tradeoff is noticeably longer link times and more complicated debugging, which is why I am thinking of enabling it only on installer builds. This way developers can continue using standard non-LTO builds which compile quickly and can be debugged without problem, while CI installers produced by github or final release binaries for which compile time is not a critical factor can get the optimization benefits for free.
But before I can enable this I need to be sure that the Linux builds can work with LTO too. Given that Linux builds have been using recent GCC versions, I would expect no issues but we have to be sure. So, any Linux user willing to assist, could you please add the -flto flag in your ADDITIONAL_CLFAGS, ADDITIONAL_OBJCFLAGS and ADDITIONAL_LDFLAGS in GNUmakefile (you may need to add the ADDITIONAL_LDLFAGS line manually) and try to build the game binary normally? You should be able to get an executable that works just like the original but be prepared to wait for a few minutes during the linking phase.
NOTE: Do not mix LTO with non-LTO object files, make sure you execute a make clean before starting the build just to be sure.
If all good we can go ahead, otherwise this will be a Windows feature only. Thanks in advance for anyone willing to provide feedback.
src/Core/NSUserDefaults+Override.m: In function ‘-[NSUserDefaults(Override) writeDictionary:toFile:]’:
src/Core/NSUserDefaults+Override.m:40:17: error: format not a string literal and no format arguments [-Werror=format-security]
40 | NSLog(@"Defaults database filename is empty when writing");
| ^
cc1obj: some warnings being treated as errors
. it would bail complaining it cannot find "Resources/espeak-data/phonetab".
This happens both with -flto and without -flto flags, now -- seems to be a new thing?
Now that we have an upgraded build system for Windows, I am in the process of enabling LTO (link time optimizations) to the executables included with the installers. LTO offers a general improvement in performance of about 5-20% on average and is basically a ticket for better performance without any code changes. The tradeoff is noticeably longer link times and more complicated debugging, which is why I am thinking of enabling it only on installer builds. This way developers can continue using standard non-LTO builds which compile quickly and can be debugged without problem, while CI installers produced by github or final release binaries for which compile time is not a critical factor can get the optimization benefits for free.
But before I can enable this I need to be sure that the Linux builds can work with LTO too. Given that Linux builds have been using recent GCC versions, I would expect no issues but we have to be sure. So, any Linux user willing to assist, could you please add the -flto flag in your ADDITIONAL_CLFAGS, ADDITIONAL_OBJCFLAGS and ADDITIONAL_LDFLAGS in GNUmakefile (you may need to add the ADDITIONAL_LDLFAGS line manually) and try to build the game binary normally? You should be able to get an executable that works just like the original but be prepared to wait for a few minutes during the linking phase.
NOTE: Do not mix LTO with non-LTO object files, make sure you execute a make clean before starting the build just to be sure.
If all good we can go ahead, otherwise this will be a Windows feature only. Thanks in advance for anyone willing to provide feedback.
Nice optimisation - it works fine on the modern Linux Clang build.
Considering for both suggestions I'm targeting the else branch, I tried mcarans non-hardcoding solution, and it works.
Hope it does, too, for environments where env variable is not set
Considering for both suggestions I'm targeting the else branch, I tried mcarans non-hardcoding solution, and it works.
Hope it does, too, for environments where env variable is not set
I have tested the modern_linux branch with both the ESPEAK_DATA_PATH and -flto changes and it works fine. I have checked in those changes to the branch.
All right, link time optimizations are now enabled for the deployment and test release installers for Linux and Windows*.
The snapshot installers have also been slightly re-configured. They now ship executables with debug information enabled and LTO disabled, so that debugging, if needed, can become easier. This makes the snapshot variant somewhat more useful, because until now the only difference between a test release and a snapshot was the watermark on the top right of the screen. If you want to concentrate on testing, you can use snapshot. If you want to just play with the best performance possible use deployment or test release.
* The modern build is required for LTO. Currently github builds Windows with the legacy environment and Linux with the modern configuration. As a result, only the Linux installers from github have LTO enabled, but you can still generate LTO builds for Windows if you build the installers yourself. This is expected to change soon, when we transition the github CI workflow to use the modern build configuration also for Windows.