GCC 11 vs. LLVM Clang 12 Performance On The Intel Core i9 11900K Is A Heated Race

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • phoronix
    Administrator
    • Jan 2007
    • 67366

    GCC 11 vs. LLVM Clang 12 Performance On The Intel Core i9 11900K Is A Heated Race

    Phoronix: GCC 11 vs. LLVM Clang 12 Performance On The Intel Core i9 11900K Is A Heated Race

    For those wondering how GCC and LLVM Clang are competing when running on Intel's latest Rocket Lake processors, here are some GCC 11 vs. LLVM Clang 12 compiler benchmarks with the Core i9 11900K running from the newly-released Fedora Workstation 34 featuring these very latest compilers. The compiler benchmarks were carried out at multiple optimization levels on each compiler.

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite
  • birdie
    Banned
    • Jul 2008
    • 3368

    #2
    The results are generally hard to read and make conclusions from.

    The reason is that `-march=native` can alter the code dramatically and it's only used for -O3 but never for -O2.

    Here's how I'd go about testing all the flags:

    -O2
    -O2 -march=native
    -O2 -march=native -flto=auto
    -O3
    -O3 -march=native
    -O3 -march=native -flto=auto


    This will double the number of tests but only in this case you can understand which options lead to which results.

    For instance for C-RAY 1.1 you're comparing -O2 to -O3 -march=native but either -O3 or -march=native could have lead to this dramatic improvement and it's not clear which one was responsible for that.

    Comment

    • skeevy420
      Senior Member
      • May 2017
      • 8656

      #3
      Code:
       -O3 -march=native -flto -fPIE -fPIC -O2 -pie -rdynamic -lpthread -lrt
      Not sure how relevant this is, but a bunch of the g++ and gcc notation lines have both -O3 and -O2 defined in them.

      Comment

      • Volta
        Senior Member
        • Apr 2019
        • 2280

        #4
        I didn't expect such GCC advantage in some tests, but both Open Source compilers are great. Are proprietary compilers still relevant?

        Comment

        • Grinch
          Senior Member
          • Apr 2018
          • 178

          #5
          Originally posted by skeevy420 View Post
          Code:
           -O3 -march=native -flto -fPIE -fPIC -O2 -pie -rdynamic -lpthread -lrt
          Not sure how relevant this is, but a bunch of the g++ and gcc notation lines have both -O3 and -O2 defined in them.
          Yeah, in case of option collision, the last one passed is the one which will be used, so in this case -O3 will be overridden by -O2

          Comment

          • Manolo
            Junior Member
            • May 2021
            • 1

            #6
            The last time I was researching why the gcc code was much faster than the clang code in C-RAY the reason was that gcc automatically inline the code of a function while clang did not. I think it must have been about 2 years since I researched this.

            Comment

            • Michael
              Phoronix
              • Jun 2006
              • 14308

              #7
              Originally posted by skeevy420 View Post
              Code:
               -O3 -march=native -flto -fPIE -fPIC -O2 -pie -rdynamic -lpthread -lrt
              Not sure how relevant this is, but a bunch of the g++ and gcc notation lines have both -O3 and -O2 defined in them.
              It's just a matter of reporting all arguments passed to the compiler. The latter parameters override the prior but for the lack of being able to query what options were used to build a given binary or what arguments were used, it's kind of a broad report of just the arguments passed to the compiler. Most all tests should be setting $CFLAGS/CXXFLAGS last in the command so they should be the ones overriding any prior optimization levels, etc.
              Michael Larabel
              https://www.michaellarabel.com/

              Comment

              • skeevy420
                Senior Member
                • May 2017
                • 8656

                #8
                Originally posted by Michael View Post

                It's just a matter of reporting all arguments passed to the compiler. The latter parameters override the prior but for the lack of being able to query what options were used to build a given binary or what arguments were used, it's kind of a broad report of just the arguments passed to the compiler. Most all tests should be setting $CFLAGS/CXXFLAGS last in the command so they should be the ones overriding any prior optimization levels, etc.
                That's what I was assuming; though I'd by lying if I didn't mention that I was also out on a limb hoping that -O2 -march=native was an over-site and was bringing significant gains.

                Comment

                • skeevy420
                  Senior Member
                  • May 2017
                  • 8656

                  #9
                  Wow. Just WOW.

                  TYVM for cleaning all that up.

                  Comment

                  • insilications
                    Junior Member
                    • Dec 2019
                    • 36

                    #10
                    Why can't -flto (LINK TIME OPTIMIZATION) lead to faster benchmarks here? It is slightly slower in some tests.

                    Comment

                    Working...
                    X