what is the best free compiler to use?

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Uri Blass
Posts: 8729
Joined: Wed Mar 08, 2006 11:37 pm
Location: Tel-Aviv Israel

what is the best free compiler to use?

Post by Uri Blass » Tue Oct 02, 2018 6:02 am

I consider going back to do some programming in C for chess and I wonder what is the best new free compiler for windows.

I see an option to download visual studio but there are 3 options community 2017 professional 2017 and enterprice 2017 and
I do not know what is the difference.

https://visualstudio.microsoft.com/vs/f ... cplusplus/

chrisw
Posts: 2856
Joined: Tue Apr 03, 2012 2:28 pm

Re: what is the best free compiler to use?

Post by chrisw » Tue Oct 02, 2018 7:03 am

They are not all free if I remember correct.

User avatar
cdani
Posts: 2105
Joined: Sat Jan 18, 2014 9:24 am
Location: Andorra
Contact:

Re: what is the best free compiler to use?

Post by cdani » Tue Oct 02, 2018 7:14 am

I use the free community version. The others are not.

Joost Buijs
Posts: 1014
Joined: Thu Jul 16, 2009 8:47 am
Location: Almere, The Netherlands

Re: what is the best free compiler to use?

Post by Joost Buijs » Tue Oct 02, 2018 9:35 am

I use both the professional (which is not free) and the community (which is free), the difference between the two is negligible. The quality of the MSVC compiler improved a lot over the last 2 years, the performance almost equals the performance of the Intel compiler. In my latest programs I use a lot of C++14 and C++17 template meta programming constructs and haven't found any problems with it yet.

Ras
Posts: 1197
Joined: Tue Aug 30, 2016 6:19 pm
Contact:

Re: what is the best free compiler to use?

Post by Ras » Tue Oct 02, 2018 9:30 pm

GCC with MingW is also a free option: https://sourceforge.net/projects/mingw-w64/
Rasmus Althoff
https://www.ct800.net

Dann Corbit
Posts: 10445
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: what is the best free compiler to use?

Post by Dann Corbit » Tue Oct 02, 2018 11:13 pm

Expanding on GCC + MINGW + MSYS2 option:

You can also get CODE::BLOCKS code editor, which allows you to debug like the MSVC version in both Windows and Linux.
https://www.msys2.org/
http://www.codeblocks.org/

On the Microsoft Compiler, only the community version is free.
The Enterprise version has lots of nice things that the community version is missing, but it costs an arm and a leg.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

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

Re: what is the best free compiler to use?

Post by phhnguyen » Wed Oct 03, 2018 1:54 am

Try gcc, it’s totally free and definitely it’s not bad.

Recently I compared my engine compiled by gcc (with Cygwin) and VS (2018 community version). The result surprised me much: the one compiled by gcc was 10 - 20% faster than the one compiled by VS, a significant margin and not as I supposed. Probably I work mainly on macOs, using gcc, thus I didn’t twist the code and settings enough for speeding up with Windows/VS. But who knows, it may happen the same for your code!
https://banksiagui.com
A freeware chess GUI, based on opensource Banksia - the chess tournament manager

odomobo
Posts: 59
Joined: Thu Jul 05, 2018 11:09 pm
Location: Chicago, IL
Full name: Josh Odom

Re: what is the best free compiler to use?

Post by odomobo » Wed Oct 03, 2018 4:48 am

phhnguyen wrote:
Wed Oct 03, 2018 1:54 am
Probably I work mainly on macOs, using gcc, thus I didn’t twist the code and settings enough for speeding up with Windows/VS.
In my experience, if you build in release mode for x64 (if you have a 64-bit processor) will get you a pretty optimal build. I'm lucky if tweaking the settings from there will give me any performance improvement. By default, it enables some pretty aggressive optimizations, including link-time optimization.

Joost Buijs
Posts: 1014
Joined: Thu Jul 16, 2009 8:47 am
Location: Almere, The Netherlands

Re: what is the best free compiler to use?

Post by Joost Buijs » Wed Oct 03, 2018 7:15 am

odomobo wrote:
Wed Oct 03, 2018 4:48 am
phhnguyen wrote:
Wed Oct 03, 2018 1:54 am
Probably I work mainly on macOs, using gcc, thus I didn’t twist the code and settings enough for speeding up with Windows/VS.
In my experience, if you build in release mode for x64 (if you have a 64-bit processor) will get you a pretty optimal build. I'm lucky if tweaking the settings from there will give me any performance improvement. By default, it enables some pretty aggressive optimizations, including link-time optimization.
With VS I usually get the best result when I enable AVX2 code generation, which most CPUs support nowadays, another thing is to disable the 'Security Check' in the generated code which also gains a few percent in speed. I'm totally happy with VS, it compiles very fast especially when you enable MP compilation, totally rebuilding my engine with VS takes about 5 sec. on my 10 core PC, and that is with the project on an old hard drive, on a SSD it will compile even faster.

It is possible that GCC generates somewhat faster code, but the difference is so small that it is negligible in practice, in my opinion GCC is rather cumbersome to use, especially on Windows, for development I would go for VS any day.

Sven
Posts: 3830
Joined: Thu May 15, 2008 7:57 pm
Location: Berlin, Germany
Full name: Sven Schüle
Contact:

Re: what is the best free compiler to use?

Post by Sven » Wed Oct 03, 2018 12:32 pm

Joost Buijs wrote:
Wed Oct 03, 2018 7:15 am
odomobo wrote:
Wed Oct 03, 2018 4:48 am
phhnguyen wrote:
Wed Oct 03, 2018 1:54 am
Probably I work mainly on macOs, using gcc, thus I didn’t twist the code and settings enough for speeding up with Windows/VS.
In my experience, if you build in release mode for x64 (if you have a 64-bit processor) will get you a pretty optimal build. I'm lucky if tweaking the settings from there will give me any performance improvement. By default, it enables some pretty aggressive optimizations, including link-time optimization.
With VS I usually get the best result when I enable AVX2 code generation, which most CPUs support nowadays, another thing is to disable the 'Security Check' in the generated code which also gains a few percent in speed. I'm totally happy with VS, it compiles very fast especially when you enable MP compilation, totally rebuilding my engine with VS takes about 5 sec. on my 10 core PC, and that is with the project on an old hard drive, on a SSD it will compile even faster.

It is possible that GCC generates somewhat faster code, but the difference is so small that it is negligible in practice, in my opinion GCC is rather cumbersome to use, especially on Windows, for development I would go for VS any day.
For my engine Jumbo GCC (even in older versions) has always created around 30-40% faster code than VS (even with VS2017 community). I talk about the 64-bit build of Jumbo's bitboard variant.
Sven Schüle (engine author: Jumbo, KnockOut, Surprise)

Post Reply