Hello guys,
I want to share with you my findings about compiling with MSVC 2019 on windows:
First, I want to say that msvc 2019 is much faster than previous versions at compiling and linking. Then, in the tps-demo project, I get a 20-30% FPS increase - debug build within the editor.
The only thing I did was to add these compile options to the SConstruct file:
if env.msvc:
env.Append(CXXFLAGS=['/std:c++17'])
env.Append(CXXFLAGS=['/Ob3ity'])
env.Append(CXXFLAGS=['/GF'])
env.Append(CXXFLAGS=['/Gs'])
env.Append(CXXFLAGS=['/Gy'])
env.Append(CXXFLAGS=['/Qpar'])
Test machine was i7700H with GTX 1070. Run the project in debug mode from the editor.
The average FPS before optimizations, it was aprox 65 FPS, at start location. And after, it was aprox 90FPS with max GI, no AA and no SSAO. Same setup will give +10FPS with a release build.
Can anyone explain why such a big difference.. Thanks!
Note that official Windows binaries are compiled using MinGW with link-time optimization enabled. See also the Godot build containers.
@Calinou I am not using official builds. I am using custom builds made for Godot 3.2-master with msvc. The only difference is the param list above. And,of course, I have not touched the source code. It's the master branch unaltered
@rpopovici If you have some time, could you share some performance numbers with individual flags being enabled/disabled? This way, we could narrow down the performance improvements to specific flags.
@Calinou It's /Ob2 or /Ob3 with msvc 2019. The other flags don't matter much. Also same setup with release build will give an extra 10FPS.
It would be nice to see how inline optimization performs on linux
I test that flags in msvc2019.... is not magic. It ups general fps (not much in a 2D game) in execution, but i think it麓s rendering, because my plugins executes slower. A text parse in a plugin in a script of+4000 lines is performed in 3500msec without flags and 4100msecs compiling with that flags. All in editor (plugins are not in game)
Perhaps this is relevant
https://github.com/plasma-umass/coz
Most helpful comment
@Calinou It's /Ob2 or /Ob3 with msvc 2019. The other flags don't matter much. Also same setup with release build will give an extra 10FPS.
It would be nice to see how inline optimization performs on linux