Re: [dev] [dwm] [st] benefits (or not) of -march=x86-64-v3 and gcc optimizations

From: Laslo Hunhold <dev_AT_frign.de>
Date: Tue, 7 Feb 2023 11:05:51 +0100

On Tue, 7 Feb 2023 10:30:24 +0200
Κρακ Άουτ <krackout_AT_gmx.com> wrote:

Dear Κρακ,

> I have compiled dwm & st using -march=x86-64-v3 (tried
> -march=x86-64-v2 also). To be honest they are both (dwm & st) fast
> and snappy with their default configuration and I cannot spot any
> difference when compiled with -march=x86-64-v3 or v2. Is there any
> point adding them?
>
> Related, would -O2 or -O3 flags give any benefit?
>
> As I mentioned, in practice I don't see any differences. I'm
> wondering if theoretically there could be some positive effect.
> People who know how exactly the code works are better suited to
> supply a definitive answer than me, that's why I'm posting here.

what Petr and Roberto said, but also: The -Os flag (i.e. go for
smallest size) often yields more performant code than -O2 or -O3.

As a general note: I found the use of efficent and smart data
structures to always be the best way to dramatically speed up code.
It's very inconsistent to rely on "smart" optimizations by the
compiler, and even though they can go very far, they can rarely beat
well-thought-out data structures.

With best regards

Laslo
Received on Tue Feb 07 2023 - 11:05:51 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 07 2023 - 11:12:07 CET