Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #80062

Re: Have you ever noticed ...

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Have you ever noticed ...
Date 2021-06-01 18:24 -0700
Organization None to speak of
Message-ID <87a6o9xdmr.fsf@nosuchdomain.example.com> (permalink)
References <s94f96$3pv$1@dont-email.me> <s94mij$1l4$2@gioia.aioe.org> <s94t9r$iin$1@dont-email.me> <s95047$4dm$1@dont-email.me> <af084372-37bb-44f6-93fa-f80d4ed25d04n@googlegroups.com>

Show all headers | View raw


Michael S <already5chosen@yahoo.com> writes:
> On Tuesday, June 1, 2021 at 12:54:30 PM UTC+3, David Brown wrote:
>> On 01/06/2021 11:06, Bonita Montero wrote: 
>> >>> If you call ... 
>> >>> C:\Program Files (x86)\Microsoft Visual 
>> >>> Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat 
>> >>> ... and then ... 
>> >>> clang --version 
>> >>> ... then you get the nearly most recent clang (V11) with MSVC ? 
>> >>> But unfortunately for most benchmarks I wrote MSVC generates 
>> >>> better code than clang. 
>> > 
>> >> What optimization flags did you use? 
>> > 
>> > -O3 
>> > There are also benchmarks which run faster with clang, 
>> > but most run faster with cl.
>> -O3 is sometimes faster than -O2, and often slower. Don't use -O3 
>> unless you know what you are doing, and have tested it to see that it is 
>> helpful for your particular requirements. (The same applies to gcc, to 
>> a slightly lesser extent.) 
>> 
>> clang also has a tendency to be enthusiastic about vectorisation and 
>> loop unrolling that can help for big data sets, but be noticeably bigger 
>> and slower on small sets. You see that especially on -O3, but also on 
>> -O2. Optimising is not just a matter of "bigger number means faster for 
>> all tests". 
>> 
>> (That said, MSVC can be quite efficient for some kinds of code - it's 
>> entirely possible that it is simply better for the examples you were using.)
>
> I was under impression that in clang -O3 is the same as -O2. A flag
> that exists for compatibility with gcc and nothing else.

As of version 12.0.0, "man clang" says:

    -O0, -O1, -O2, -O3, -Ofast, -Os, -Oz, -Og, -O, -O4
    Specify which optimization level to use:

    -O0 Means “no optimization”: this level compiles the 
        fastest and generates the most debuggable code.

    -O1 Somewhere between -O0 and -O2.

    -O2 Moderate level of optimization which enables most
        optimizations.

    -O3 Like -O2, except that it enables optimizations that
        take longer to perform or that may generate larger
        code (in an attempt to make the program run faster).

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Have you ever noticed ... Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-01 07:06 +0200
  Re: Have you ever noticed ... Juha Nieminen <nospam@thanks.invalid> - 2021-06-01 07:11 +0000
    Re: Have you ever noticed ... Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-01 11:06 +0200
      Re: Have you ever noticed ... David Brown <david.brown@hesbynett.no> - 2021-06-01 11:54 +0200
        Re: Have you ever noticed ... Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-01 12:25 +0200
          Re: Have you ever noticed ... Bonita Montero <Bonita.Montero@gmail.com> - 2021-06-02 04:51 +0200
            Re: Have you ever noticed ... Doctor Who <doc@tardis.org> - 2021-06-02 05:12 +0200
              Re: Have you ever noticed ... doctor@doctor.nl2k.ab.ca (The Doctor) - 2021-06-02 04:10 +0000
        Re: Have you ever noticed ... Michael S <already5chosen@yahoo.com> - 2021-06-01 13:23 -0700
          Re: Have you ever noticed ... Real Troll <real.troll@trolls.com> - 2021-06-01 22:47 +0100
          Re: Have you ever noticed ... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-01 18:24 -0700
            Re: Have you ever noticed ... Michael S <already5chosen@yahoo.com> - 2021-06-02 14:02 -0700
      Re: Have you ever noticed ... Juha Nieminen <nospam@thanks.invalid> - 2021-06-02 05:07 +0000
      Re: Have you ever noticed ... Vir Campestris <vir.campestris@invalid.invalid> - 2021-06-06 21:30 +0100

csiph-web