Which is the best compiler for Windows Executables

Discussion of chess software programming and technical issues.

Moderator: Ras

rickpo
Posts: 2
Joined: Tue Jul 20, 2021 9:20 am
Full name: Rick Powell

Re: Which is the best compiler for Windows Executables

Post by rickpo »

Ras wrote: Tue Jun 06, 2023 7:57 am 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.
Wow. I never tested on AMD, that's very interesting.
syzygy
Posts: 5694
Joined: Tue Feb 28, 2012 11:56 pm

Re: Which is the best compiler for Windows Executables

Post by syzygy »

Joost Buijs wrote: Sun Jun 04, 2023 5:19 pm 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.
I think 10% faster is about 10 Elo and certainly more than 5 Elo, so this will certainly make a difference in (average) game outcome.
OliverBr
Posts: 794
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: Which is the best compiler for Windows Executables

Post by OliverBr »

Unfortunately one minor change in 5.10.2 didn't go so well, I have removed all 5.10.2 from my homepage. Soon releasing a 5.10.3.
Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink
chrjly
Posts: 41
Joined: Wed Feb 03, 2021 10:45 pm
Full name: Christophe Jolly

Re: Which is the best compiler for Windows Executables

Post by chrjly »

OliverBr wrote: Sun Jun 04, 2023 2:51 pm Hello :)

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.

Any tip would be very helpful.
Thank you a lot!
The mingw-w64 compiler generates an executable 10% faster than Visual Studio 2019 when I compile my chess program sources. Mingw is a gcc compiler that generates windows executables.
I have used the -O3 option for mingw and the /O2 option for Visual Studio.
It's the x86_64-w64-mingw32-gcc compiler running under Linux (gcc version 8.3-win32) but there is a windows version.
mig2004
Posts: 256
Joined: Wed Oct 02, 2013 12:36 am

Re: Which is the best compiler for Windows Executables

Post by mig2004 »

I´ve tried MSVC from 2008 trough 2018 and it lacked speed with all or selected optimizations. I remember Visual Studio 2019 did not even allowed certain optimizaztions back then. (It was too recent at that time). All Visual Studio compilations of stockfish were shortchanged in speed of execution. It was about 20% slower than Mingw with MYSYS. I never went back to msvc.

I currently switched to TDM-GCC 10.3.0 due to a bug in MYSYS2 mingw. As soon as they fix it i will try it and compare speeds.
Whiskers
Posts: 243
Joined: Tue Jan 31, 2023 4:34 pm
Full name: Adam Kulju

Re: Which is the best compiler for Windows Executables

Post by Whiskers »

In Willow, using Clang instead of gcc gained somewhere between 5 and 10 ELO. I tried it on a whim and didn't believe the first SPRT result was anything but a fluke, so I retested it and still got the same result.

First test:

ELO | 7.51 +- 5.30 (95%)
SPRT | 8.0+0.08s Threads=1 Hash=32MB
LLR | 3.00 (-2.94, 2.94) [0.00, 5.00]
GAMES | N: 9024 W: 2569 L: 2374 D: 4081
https://chess.swehosting.se/test/1181/

Second test:

ELO | 10.52 +- 6.66 (95%)
SPRT | 8.0+0.08s Threads=1 Hash=32MB
LLR | 2.96 (-2.94, 2.94) [0.00, 5.00]
GAMES | N: 5816 W: 1709 L: 1533 D: 2574
https://chess.swehosting.se/test/1187/
chessica
Posts: 920
Joined: Thu Aug 11, 2022 11:30 pm
Full name: Esmeralda Pinto

Re: Which is the best compiler for Windows Executables

Post by chessica »

OliverBr wrote: Sun Jun 04, 2023 2:51 pm Hello :)

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.

Any tip would be very helpful.
Thank you a lot!
The answer is simple!

Give us a little program to compile and we compiles.