Announcement

Collapse
No announcement yet.

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

  • 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.

    https://www.phoronix.com/vr.php?view=30192

  • #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


    • #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


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

        Comment


        • #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


          • #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


            • #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
              http://www.michaellarabel.com/

              Comment


              • #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


                • #9
                  Wow. Just WOW.

                  TYVM for cleaning all that up.

                  Comment


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

                    Comment

                    Working...
                    X