All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: louis.chauvet@bootlin.com, Buildroot List <buildroot@buildroot.org>
Subject: Re: [Buildroot] [PATCH] Config.in: change default optimization level from -Os to -O2
Date: Wed, 27 Dec 2023 18:32:53 +0100	[thread overview]
Message-ID: <ZYxfxXC4-vKZlmcZ@landeda> (raw)
In-Reply-To: <20231227165840.2900718-1-thomas.petazzoni@bootlin.com>

Thomas, All,

On 2023-12-27 17:58 +0100, Thomas Petazzoni via buildroot spake thusly:
> Historically, Buildroot has defaulted to -Os as the gcc optimization
> flags. However, this default is probably not the most appropriate
> anymore, and this commit therefore changes the default to -O2.
> 
> 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.

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

But otherwise, I agree that, -Os does not bring much size gain, compared
to storage of devices nowadays, so, except for those little nits:

Acked-by: Yann E. MORIN <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> - -Os is much less widely tested than -O2. For example, with recent
>    versions of gcc, there are parts of Qt5 that segfault when compiled
>    with -Os and work perfectly fine with -O2. Yes, it's a compiler bug
>    that should be fixed, but in the mean time, having a default that's
>    more widely used/tested makes sense.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  Config.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Config.in b/Config.in
> index 554b4062eb..c38b1e6454 100644
> --- a/Config.in
> +++ b/Config.in
> @@ -474,7 +474,7 @@ config BR2_STRIP_EXCLUDE_DIRS
>  
>  choice
>  	prompt "gcc optimization level"
> -	default BR2_OPTIMIZE_S
> +	default BR2_OPTIMIZE_2
>  	help
>  	  Set the optimization level for gcc
>  
> -- 
> 2.43.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2023-12-27 17:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-27 16:58 [Buildroot] [PATCH] Config.in: change default optimization level from -Os to -O2 Thomas Petazzoni via buildroot
2023-12-27 17:32 ` Yann E. MORIN [this message]
2024-01-02  8:39   ` Thomas Petazzoni via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZYxfxXC4-vKZlmcZ@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=louis.chauvet@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.