Hi all,
I've been chatting on IRC when someone told me that LLVM/clang produced faster
code for him than GCC for what he called “full optimisations” which turned out
to be “-O3” and isn't the best you can get. Nevertheless, it sparked my
interest regarding how well clang/LLVM performed against GCC when benchmarking
Freecell Solver.
I benchmarked GCC and LLVM/clang with:
1. The -flto flag and without it. see
https://gcc.gnu.org/wiki/LinkTimeOptimization .
2. With and without PGO - profile-guided optimisations - see
https://en.wikipedia.org/wiki/Profile-guided_optimization .
3. I used gcc-4.9.x for the PGO benchmark because from my experience, PGO does
not take effect on gcc-5.x-and above - see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67463 .
Anyway here are the results of the individual timings - in seconds of the
benchmark in the various compilers and options (smaller is better):
< QUOTE >
clang-with-flto-and-without-pgo 10.0814340114594
clang-with-flto-and-without-pgo 10.0567920207977
clang-with-flto-and-without-pgo 10.0605990886688
clang-with-flto-and-without-pgo 10.0621140003204
clang-with-flto-and-without-pgo 10.054388999939
clang-with-flto-and-without-pgo 10.0598800182343
clang-with-flto-and-without-pgo 10.025664806366
clang-with-flto-and-without-pgo 10.028450012207
clang-without-flto-and-without-pgo 9.15759706497192
clang-without-flto-and-without-pgo 9.17348504066467
clang-without-flto-and-without-pgo 9.16873383522034
clang-without-flto-and-without-pgo 9.16774201393127
clang-without-flto-and-without-pgo 9.16468191146851
clang-without-flto-and-without-pgo 9.15693616867065
clang-without-flto-and-without-pgo 9.16760301589966
clang-without-flto-and-without-pgo 9.17835593223572
clang-without-flto-and-with-pgo 8.9583420753479
clang-without-flto-and-with-pgo 8.95796799659729
clang-without-flto-and-with-pgo 8.97303080558777
clang-without-flto-and-with-pgo 8.95967793464661
clang-without-flto-and-with-pgo 8.95712614059448
clang-without-flto-and-with-pgo 8.96093201637268
clang-without-flto-and-with-pgo 8.96662592887878
clang-without-flto-and-with-pgo 8.9606819152832
gcc-4.9.x-with-flto-and-with-pgo 8.70284199714661
gcc-4.9.x-with-flto-and-with-pgo 8.6780469417572
gcc-4.9.x-with-flto-and-with-pgo 8.68615484237671
gcc-4.9.x-with-flto-and-with-pgo 8.68566107749939
gcc-4.9.x-with-flto-and-with-pgo 8.70519614219666
gcc-4.9.x-with-flto-and-with-pgo 8.68831300735474
gcc-4.9.x-with-flto-and-with-pgo 8.69163298606873
gcc-4.9.x-with-flto-and-with-pgo 8.6886510848999
gcc-with-flto-and-without-pgo 9.2524139881134
gcc-with-flto-and-without-pgo 9.28339195251465
gcc-with-flto-and-without-pgo 9.23484015464783
gcc-with-flto-and-without-pgo 9.25453805923462
gcc-with-flto-and-without-pgo 9.26543188095093
gcc-with-flto-and-without-pgo 9.24664497375488
gcc-with-flto-and-without-pgo 9.25972700119019
gcc-with-flto-and-without-pgo 9.28069496154785
gcc-without-flto-and-without-pgo 9.45089507102966
gcc-without-flto-and-without-pgo 9.44254398345947
gcc-without-flto-and-without-pgo 9.44231796264648
gcc-without-flto-and-without-pgo 9.45587301254272
gcc-without-flto-and-without-pgo 9.4609260559082
gcc-without-flto-and-without-pgo 9.41726183891296
gcc-without-flto-and-without-pgo 9.42047500610352
gcc-without-flto-and-without-pgo 9.43671798706055
< / QUOTE>
Some conclusions:
1. For some reason, the -flto flag makes clang produce much slower code, while
improving the performance of the GCC code.
2. clang produces faster results than GCC with no PGO.
3. GCC-4.9.x's PGO code is faster than clang’s.
Anyway, there were several commits involved in getting this to work including
https://github.com/shlomif/fc-solve/commit/843b4348b2ef9daa12143f0bcd2b878d496d6314
and some command line script hackery.
Hopefully I'll post some more stuff that I've been working on in the fc-solve
git master branch soon.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
List of Text Processing Tools - http://shlom.in/text-proc
God gave us two eyes and ten fingers so we will type five times as much as we
read.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
Received on Mon Feb 08 2016 - 08:01:28 IST