Closed VOM7HC closed 3 years ago
Hi @WesleyKhoiVo! Thanks for your contribution! I will check it out after I finish with the PR for gfootball
.
I plan to finalize the changes and merge windows
branch once I have enough time.
I thought that cmake
's --config Release
adds O2
flag automatically, but indeed LTCG
might squeeze in some additional performance.
I can't find any document or link say cmake add O2 automatically when we switch to Release, so I added it manually.
Note: it just improve CPU usage, FPS still drop sometime, so we need more time to cleanup game engine
I'm testing the PR and get the following warning after building:
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
.
Do you have it too?
Update comment: MSVC require so much. I use Visual Studio solution, which generated by CMake, then I added LTCG flag in properties window to build, for test performance. It may be auto add or remove some other flags when I add LTCG. Then I added LTCG back to cmakelist.txt. Now I will find solution, then update it again Reference issue and fix it from MS forum: Compiling with "Whole Program Optimization" but linker says no code generation required
And linker performance is just effect to compile time, not effect to runtime anyway :smile:
Hi @vi3itor, can you recheck again?
I checked, the warning is gone.
Funny, the total size of the *.lib
files is 1.3 Gb, with blunted2.lib
along being 706 Mb. Since only an executable and .dll
are required for running the game I will add an installation script to compile the game and remove unnecessary files. Probably even better is to improve CMakeLists.txt
.
Yeah, I think I will remove *.lib
in another PR. This PR is just improve performance via flags compiler.
CMakeList current just optimize for Unix. Clang and GNU GCC have O3 flag for optimize performance code. MSVC doesn't have O3, so I use O2 flag for speed and LTCG for force compiler use inline function every time. In my personal test, I saw in task manager, use O2 and LTCG help to improve estimate 2% ~ 5% CPU usage.
LTCG flag O2 flag