public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: ibuclaw@gdcproject.org
To: "Jeff Law" <jeffreyalaw@gmail.com>,
	"Jeff Law via Gcc-patches" <gcc-patches@gcc.gnu.org>,
	"Luís Ferreira" <contact@lsferreira.net>
Subject: Re: [PATCH] libiberty: d-demangle: use switch instead of if-else
Date: Mon, 4 Oct 2021 09:25:14 +0200 (CEST)	[thread overview]
Message-ID: <248182573.176926.1633332314228@office.mailbox.org> (raw)
In-Reply-To: <43f9005e-bc54-842b-b7c2-d3e899d8714f@gmail.com>

> On 03/10/2021 23:55 Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
>  
> On 9/29/2021 7:08 PM, Luís Ferreira wrote:
> > This patch allows the compiler to efficiently generate jump tables instead of
> > using if-else-if.
> >
> > Signed-off-by: Luís Ferreira <contact@lsferreira.net>
> I'm not sure this is terribly useful.  Compilers have the ability to 
> analyze the underlying code and make sensible decisions for how to 
> implement either form.   So the right metric here is does this make the 
> code cleaner/easier to understand.  With just 3 clauses it's hard (for 
> me) to make the case that it is considerably cleaner.
> 

I'd be inclined to agree here.

FAOD, I put together a quick example of what difference this patch makes.  Other than freely reordering the conditions, the answer is nothing.

https://godbolt.org/z/nKjjv64zM

Iain.

  reply	other threads:[~2021-10-04  7:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30  1:08 Luís Ferreira
2021-10-03 21:55 ` Jeff Law
2021-10-04  7:25   ` ibuclaw [this message]
2021-10-04 14:56   ` Luís Ferreira

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=248182573.176926.1633332314228@office.mailbox.org \
    --to=ibuclaw@gdcproject.org \
    --cc=contact@lsferreira.net \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).