[Buildroot] [PATCH] Config.in: change default optimization level from -Os to -O2
Thomas Petazzoni
thomas.petazzoni at bootlin.com
Tue Jan 2 08:39:04 UTC 2024
Hello,
Thanks for the feedback.
On Wed, 27 Dec 2023 18:32:53 +0100
"Yann E. MORIN" <yann.morin.1998 at free.fr> wrote:
> > Here are some arguments in favor of this change:
> >
> > - Most Buildroot uses use Buildroot for platforms that have a
>
> s/uses/users/ maybe?
>
> > reasonable amount of storage, and the difference between -Os and -O2
> > in terms of code size is no longer than significant compared to the
>
> s/than/as/
>
> > size of storage typically available on average embedded Linux
> > devices
>
> ... nowadays.
I sent a v2 (where I messed up) and then a v3, fixing those. I actually
made another change: the Config.in help text of BR2_OPTIMIZE_S
explicitly mentioned that it was the default. So I updated this and
moved the text to BR2_OPTIMIZE_2.
>
> > - -Os can have a pretty bad performance impact, compared to -O2.
>
> What impact are we speaking of? Basically, -Os is -O2 except for
> optimisations that increase code size. Also, smaller code fit better
> in caches, so there can be a speed gain to have smaller code too.
>
> So, stating that -Os has a "pretty bad" performance impact is not that
> obvious.
I obviously don't have hard numbers, but I definitely remember
getting reports of performance problems that got solved by moving to
-O2. However, I honestly don't remember if it was a bug report in our
public bug tracker, or an issue in a customer project. But I had in my
TODO-list for a long time to send this patch, because on multiple
occasions I saw people being hit by issues being caused by the default
setting of -Os.
> Acked-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Thanks, the v3 has your Acked-by :-)
Best regards,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
More information about the buildroot
mailing list