Stockfish compiled by Visual Studio is much slower than by Cygwin?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
phhnguyen
Posts: 1437
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: Stockfish compiled by Visual Studio is much slower than by Cygwin?

Post by phhnguyen »

syzygy wrote: Thu Jun 28, 2018 11:55 pm The lock is necessary because the main thread and the UI thread can try to print at the same time. For example, if the GUI sends "stop" and "isready" commands in quick succession, the response to isready may interfere with the response to stop (if locking is removed), and the GUI can get confused.
Thanks for the explanation. I won't change the io lock. I also realise the code std::endl flushes the buffer thus we don't need to add any more code for flushing.

If Stockfish's team does not want to surprise new Visual studio's users when they benchmark for their exe files, just add below code to init function of Search class. The code does not affect any OS/compiler except Windows/VS:

Code: Select all

#if defined(_MSC_VER)
	setvbuf(stdout, 0, _IOLBF, 4096);
#endif
https://banksiagui.com
The most features chess GUI, based on opensource Banksia - the chess tournament manager
User avatar
phhnguyen
Posts: 1437
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: Stockfish compiled by Visual Studio is much slower than by Cygwin?

Post by phhnguyen »

Joost Buijs wrote: Fri Jun 29, 2018 7:06 am Intel being ~2% faster, MSVC is not as bad anymore as it used to be.
From my and someone's experiences here, Stockfish exe compiled by VS is slower than ones by gcc (with Cygwin/MingW) at least 7%. Thus +2% is still significantly slower. I would be so surprised if both Intel compiler and VS are lagging behind gcc.

Could you verify please? Just download Cygwin or MingW and gcc, compile and run benchmark. Thanks
https://banksiagui.com
The most features chess GUI, based on opensource Banksia - the chess tournament manager
Joost Buijs
Posts: 1564
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Stockfish compiled by Visual Studio is much slower than by Cygwin?

Post by Joost Buijs »

phhnguyen wrote: Fri Jun 29, 2018 2:20 pm
Joost Buijs wrote: Fri Jun 29, 2018 7:06 am Intel being ~2% faster, MSVC is not as bad anymore as it used to be.
From my and someone's experiences here, Stockfish exe compiled by VS is slower than ones by gcc (with Cygwin/MingW) at least 7%. Thus +2% is still significantly slower. I would be so surprised if both Intel compiler and VS are lagging behind gcc.

Could you verify please? Just download Cygwin or MingW and gcc, compile and run benchmark. Thanks
Stockfish is optimized using gcc, so it's quite possible that it will run a bit slower when compiled with Intel or MSVC, these compilers react all differently to certain code constructs.

I ran the benchmark on my i7-6950x at 3800MHz., with PGO I can probably get another 5 or 10% increase in speed, I don't want to install Cygwin or MinGW to compare it with gcc because I think these small differences are not important anyway.
Sesse
Posts: 300
Joined: Mon Apr 30, 2018 11:51 pm

Re: Stockfish compiled by Visual Studio is much slower than by Cygwin?

Post by Sesse »

phhnguyen wrote: Fri Jun 29, 2018 2:20 pm I would be so surprised if both Intel compiler and VS are lagging behind gcc.
Why?