GCC 8.1 vs GCC 10.1

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.
Gabor Szots
Posts: 504
Joined: Sat Jul 21, 2018 5:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

GCC 8.1 vs GCC 10.1

Post by Gabor Szots » Wed Jul 01, 2020 1:45 pm

Hi all,

I am not a programmer but still have successfully compiled some C or C++ engines using GCC 8.1. I have now installed GCC 10.1 and I noticed that the file sizes I obtain using it are much bigger than the ones made with 8.1. Also, the executables are slower.
I have an i5-4690K (Haswell) CPU and I mostly use the command gcc (or g++) *.c (or cpp) -O3 -march=native -o...

Is that only for me? Do you think I have to do something special?
Gabor Szots
CCRL testing group

mhouppin
Posts: 60
Joined: Wed Feb 12, 2020 4:00 pm
Full name: Morgan Houppin

Re: GCC 8.1 vs GCC 10.1

Post by mhouppin » Wed Jul 01, 2020 2:13 pm

Gabor Szots wrote:
Wed Jul 01, 2020 1:45 pm
Hi all,

I am not a programmer but still have successfully compiled some C or C++ engines using GCC 8.1. I have now installed GCC 10.1 and I noticed that the file sizes I obtain using it are much bigger than the ones made with 8.1. Also, the executables are slower.
I have an i5-4690K (Haswell) CPU and I mostly use the command gcc (or g++) *.c (or cpp) -O3 -march=native -o...

Is that only for me? Do you think I have to do something special?
I got same issues with gcc-10 on my machine, so I guess this new version still needs to be refined. For now gcc-9 seems the version that gives best performance and binary size.

User avatar
Ajedrecista
Posts: 1455
Joined: Wed Jul 13, 2011 7:04 pm
Location: Madrid, Spain.
Contact:

Re: GCC 8.1 vs GCC 10.1.

Post by Ajedrecista » Wed Jul 01, 2020 4:28 pm

Hello Gabor:
Gabor Szots wrote:
Wed Jul 01, 2020 1:45 pm
Hi all,

I am not a programmer but still have successfully compiled some C or C++ engines using GCC 8.1. I have now installed GCC 10.1 and I noticed that the file sizes I obtain using it are much bigger than the ones made with 8.1. Also, the executables are slower.
I have an i5-4690K (Haswell) CPU and I mostly use the command gcc (or g++) *.c (or cpp) -O3 -march=native -o...

Is that only for me? Do you think I have to do something special?
I am neither a programmer. Have you tried -s flag for size? I mean, compiling with -O3 -s instead of only -O3. It worked with older versions of GCC and G++ though I do not know if this flag still exists or has been removed. The size flag is listed as -Os under this blog article from 2019, which explains that -Os takes -O2 as the baseline.

I am clueless about the speed issue.

Regards from Spain.

Ajedrecista.

Gabor Szots
Posts: 504
Joined: Sat Jul 21, 2018 5:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: GCC 8.1 vs GCC 10.1.

Post by Gabor Szots » Wed Jul 01, 2020 4:55 pm

Ajedrecista wrote:
Wed Jul 01, 2020 4:28 pm
Have you tried -s flag for size? I mean, compiling with -O3 -s instead of only -O3. It worked with older versions of GCC and G++ though I do not know if this flag still exists or has been removed. The size flag is listed as -Os under this blog article from 2019, which explains that -Os takes -O2 as the baseline.

I am clueless about the speed issue.
Thanks, -s indeed helps a lot (tried with Achillees, it shrinks the size to 1/3. However, it slows down the executable considerably.
Gabor Szots
CCRL testing group

mar
Posts: 2122
Joined: Fri Nov 26, 2010 1:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: GCC 8.1 vs GCC 10.1

Post by mar » Wed Jul 01, 2020 8:04 pm

Right, those idiots try hard to make each new version of gcc slower than the one before. Fortunately we have expert-testers who expose them. Good job Gabor!
Martin Sedlak

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

Re: GCC 8.1 vs GCC 10.1

Post by Dann Corbit » Wed Jul 01, 2020 11:37 pm

Did you remember to run strip after the compile finishes?
That usually reduces the size a lot.

If you build a static executable, it will be much larger than one that loads the DLL files dynamically. But if you do not link a static executable, you will have to have the DLL files available for the executables by putting them in the engine folder or the system path.

I get really good speed with GCC 10. What engine are you compiling?

I you are only going to run the binary on your machine, then set arch to native and do a profile guided build. Caveat: If you have a new AMD machine, then do NOT do a native build, but build only for an SSE target, because AMD does software implementation of some instructions and the software implementations are truly awful. PEXT is used by chess engines a lot and it is horrible on AMD, for instance.
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
lucasart
Posts: 3109
Joined: Mon May 31, 2010 11:29 am
Full name: lucasart
Contact:

Re: GCC 8.1 vs GCC 10.1

Post by lucasart » Thu Jul 02, 2020 3:38 am

mar wrote:
Wed Jul 01, 2020 8:04 pm
Right, those idiots try hard to make each new version of gcc slower than the one before. Fortunately we have expert-testers who expose them. Good job Gabor!
I switched to clang long ago and never looked back.

Though I did understand your irony on -s (which some people seem to confuse with -Os), my experience is that gcc compiles are worse and more bloated than they were with older versions. Somewhere iaround GCC 4.6 we reached the golden age of gcc, we went downhill ever since, whereas LLVM is stronger than ever.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.

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

Re: GCC 8.1 vs GCC 10.1

Post by Dann Corbit » Thu Jul 02, 2020 5:03 am

For me gcc and llvm produce binaries that are approximately equivalent. Sometimes gcc is faster and sometimes llvm is faster.
I will say this, the llvm compiler diagnostics are the best on the planet. If for no other reason, it should be used for its lint like qualities.
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.

Gabor Szots
Posts: 504
Joined: Sat Jul 21, 2018 5:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: GCC 8.1 vs GCC 10.1

Post by Gabor Szots » Thu Jul 02, 2020 5:53 am

Dann Corbit wrote:
Wed Jul 01, 2020 11:37 pm
Did you remember to run strip after the compile finishes?
That usually reduces the size a lot.

If you build a static executable, it will be much larger than one that loads the DLL files dynamically. But if you do not link a static executable, you will have to have the DLL files available for the executables by putting them in the engine folder or the system path.

I get really good speed with GCC 10. What engine are you compiling?

I you are only going to run the binary on your machine, then set arch to native and do a profile guided build. Caveat: If you have a new AMD machine, then do NOT do a native build, but build only for an SSE target, because AMD does software implementation of some instructions and the software implementations are truly awful. PEXT is used by chess engines a lot and it is horrible on AMD, for instance.
You mention things here which I don't really understand. No, I did not run strip. In fact size is not that important, speed is.
I have tried Achillees, Halogen, Monolith with 10.1.
Gabor Szots
CCRL testing group

Ras
Posts: 1401
Joined: Tue Aug 30, 2016 6:19 pm
Full name: Rasmus Althoff
Contact:

Re: GCC 8.1 vs GCC 10.1

Post by Ras » Thu Jul 02, 2020 6:07 am

Is -O2 faster? -O3 often bloats the code so that the optimisations turn out to be slower.
Rasmus Althoff
https://www.ct800.net

Post Reply