Which compiler is known to create the fastest engine code for Windows platforms?
I have been using Visual Studio before and my engine underperforms a little with the executable compared to MacOSX or Linux. Thus is would like to try another Windows compiler.
I use Clang on Windows too, typically executables are approx. 10% faster when compiled with Clang. It won't make the difference between winning or losing a game though.
Each compiler has it's own strength and weaknesses, imo MSVC has better error checking, so I often use both.
Joost Buijs wrote: ↑Sun Jun 04, 2023 5:19 pm
Each compiler has it's own strength and weaknesses, imo MSVC has better error checking, so I often use both.
I do the same with GCC and Clang, while they're quite similar, they both have some warnings that the other one doesn't have.
Did you compile the Visual Studio build with all the optimizations for speed turned on?
that is the /Ox command line option. you can tweak various settings through the GUI.
Also look for functions that can be good candidates for "inline". functions marked with "inline" will be candidates for inlining by the cost/benefit feature of the compiler.
A couple years ago I tried the Intel C++ compiler and got significantly better speed compared to the MS compiler. I was pretty impressed with it. But it didn't come bundled with VisualStudio 2022, so and I haven't tried it since 2022 came out.
rickpo wrote: ↑Tue Jun 06, 2023 6:36 amA couple years ago I tried the Intel C++ compiler and got significantly better speed compared to the MS compiler.
Back then, the Intel compiler deliberately sabotaged performance on AMD CPUs by not checking the supported instruction set, but by checking for specific Intel models. Intel didn't even disclose that until the FTC forced them. It seems this has changed because Intel has moved to Clang, provided you use the correct compiler options, but then the performance advantage it once had on Intel CPUs is also pretty much gone. See also: https://www.agner.org/forum/viewtopic.php?t=6
MOBMAT wrote: ↑Mon Jun 05, 2023 7:54 pm
Did you compile the Visual Studio build with all the optimizations for speed turned on?
that is the /Ox command line option. you can tweak various settings through the GUI.
Oddly enough, while /Ox specifically enables speed optimizations, the option /O2 also enables other optimizations that can improve execution speed as well. Lately this has been documented as the way to get the most performance out of the compiler.