We are talking about the latest master branch in SF as of 06.12.2021 -> https://github.com/official-stockfish/Stockfish
Also the latest compilers were installed clang-12 and gcc-11 made the default by
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100
Anyways here is the comparison:
Code: Select all
./stockfish bench 128 1 20 default depth
clang: 57488149 - 2562659nps (run in ubuntu)
gcc: 57488149 - 2451102nps (run in ubuntu)
wingw: 57488149 - 2494495nps (run in windows)
msvc: 57488149 - 1999935nps (run in windows)
Run to run variance was pretty low for example my second run in windows was 1999949nps. It seems that MSVC cannot find some optimisations that clang and gcc found.
So there we have it. Current Stockfish with current compilers and the difference between gcc and clang is low but clear. Clang comes out ahead far outside of error of margin (at least on ryzen). Oh yeah and disabling AVX2 made performance 10% of what it is with it enabled.
I could not get native clang to work on windows (link time errors) so does anyone have experience? Download and build this: https://github.com/llvm/llvm-project and then build like you would without the makefile in windows.