public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: 'GNU C Library' <libc-alpha@sourceware.org>
Subject: Re: [PATCH v12 14/31] string: Improve generic strrchr with memrchr and strlen
Date: Fri, 3 Feb 2023 09:15:38 -0300	[thread overview]
Message-ID: <28462546-34c9-5a09-599e-bb66959db500@linaro.org> (raw)
In-Reply-To: <PAWPR08MB8982A27C2B0AF83BFC1EC91883D69@PAWPR08MB8982.eurprd08.prod.outlook.com>



On 02/02/23 16:54, Wilco Dijkstra wrote:
> Hi Adhemerval,
> 
>  STRRCHR (const char *s, int c)
>  {
> +  return __memrchr (s, c, strlen (s) + 1);
>  }
> 
> LGTM
> 
> I did a quick check on AArch64 and the speedup vs the old generic version
> on bench-strrchr is 9.9 times! It's ~15% slower overall than the assembler
> strrchr.
> 
> While the benchmark is not perfect, it shows that if you have decent strlen
> and memrchr then strlen+memchr gives a competitive strrchr.

Yeah, I saw a similar improvement on my side as well.  Thanks for verify it
as well.

  reply	other threads:[~2023-02-03 12:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 19:54 Wilco Dijkstra
2023-02-03 12:15 ` Adhemerval Zanella Netto [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-02-02 18:11 [PATCH v12 00/31] Improve generic string routines Adhemerval Zanella
2023-02-02 18:11 ` [PATCH v12 14/31] string: Improve generic strrchr with memrchr and strlen Adhemerval Zanella
2023-02-04  3:06   ` Richard Henderson
2023-02-06 14:01     ` Adhemerval Zanella Netto

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=28462546-34c9-5a09-599e-bb66959db500@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    /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).