Software dvelopment on a Mac

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Rémi Coulom
Posts: 438
Joined: Mon Apr 24, 2006 8:06 pm

Re: Software dvelopment on a Mac

Post by Rémi Coulom »

These are my compilers:

Code: Select all

coulom@remis-macbook:~/rc2/programs/CrazyStone/compgcc>clang --version
Apple clang version 2.0 (tags/Apple/clang-138) (based on LLVM 2.9svn)
Target: x86_64-apple-darwin10
Thread model: posix
coulom@remis-macbook:~/rc2/programs/CrazyStone/compgcc>gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The benchmark of my Go program takes 5.85 seconds with clang, 4.9 seconds with gcc. I may be overfitting gcc a little, since I do most of my performance tuning with it. I don't use pgo: it makes my program slower.

clang is much faster and produces better diagnostics, though. I prefer using it for development.

Rémi
micron
Posts: 155
Joined: Mon Feb 15, 2010 9:33 am
Location: New Zealand

Re: Software dvelopment on a Mac

Post by micron »

Rémi Coulom wrote: The benchmark of my Go program takes 5.85 seconds with clang, 4.9 seconds with gcc. I may be overfitting gcc a little, since I do most of my performance tuning with it. I don't use pgo: it makes my program slower.

clang is much faster and produces better diagnostics, though. I prefer using it for development.
You can likely improve the clang-built program's speed by turning on link-time optimization. See this thread
http://www.talkchess.com/forum/viewtopic.php?t=38541
which gives some figures for Stockfish builds, comparing clang (a.k.a. LLVM compiler) with gcc 4.2.
Clang works very nicely indeed with flags -O3 -flto, for my own engine as well as SF. Regarding diagnostics quality, see
http://clang.llvm.org/diagnostics.html

Robert P.
Rémi Coulom
Posts: 438
Joined: Mon Apr 24, 2006 8:06 pm

Re: Software dvelopment on a Mac

Post by Rémi Coulom »

micron wrote: You can likely improve the clang-built program's speed by turning on link-time optimization.
Thanks for the tip, but my program is monolithic: I #include all the classes into one single file for the release build. I suppose that cannot be worse than any form of link-time optimization.

Rémi