public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Florian Weimer <fweimer@redhat.com>,
	 "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
Subject: Re: [PATCH] elf: Replace memcmp with __memcmpeq for variable size
Date: Mon, 7 Feb 2022 06:00:50 -0800	[thread overview]
Message-ID: <CAMe9rOrwp2rLidaTqpHn_XjdEpRBGpB8U62pzguMcNN1n31Dow@mail.gmail.com> (raw)
In-Reply-To: <14db2006-daf6-903c-f750-0db19842a46a@linaro.org>

On Mon, Feb 7, 2022 at 5:30 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 07/02/2022 10:27, H.J. Lu via Libc-alpha wrote:
> > On Mon, Feb 7, 2022 at 5:19 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>
> >> * H. J. Lu:
> >>
> >>>> This must be something else.  According to the numbers, we save ~159
> >>>> between ~569 cycles per __memcmpeq call.  That is just not realistic.
> >>>
> >>> I removed the cycle info from the commit log.
> >>
> >> If we can't show the change is beneficial, is it worth the additional
> >> 1000 or so bytes in the loader text?
> >>
> >
> > $ LD_DEBUG=statistics elf/tst-relsort1 --direct
> >
> > does show improvements when __memcmpeq is called 24 times.
> > But the cycle number changes for each run.  The overall trend is
> > faster.  It will be more obvious when memcmp is called more often.
> >
>
> My understanding is this optimization would eventually be implemented by

What kinds of codes should compilers generate?  For glibc internal
usage, we can write codes in such a way that the generated codes
are very similar to what compilers should generate.

> the compiler, so maybe it would be better to let it optimize if suitable
> (similar to what we are aiming for math code).


-- 
H.J.

  reply	other threads:[~2022-02-07 14:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-06 21:09 H.J. Lu
2022-02-06 22:19 ` Florian Weimer
2022-02-07  0:20   ` H.J. Lu
2022-02-07 10:40     ` Florian Weimer
2022-02-07 13:13       ` H.J. Lu
2022-02-07 13:19         ` Florian Weimer
2022-02-07 13:27           ` H.J. Lu
2022-02-07 13:30             ` Adhemerval Zanella
2022-02-07 14:00               ` H.J. Lu [this message]
2022-02-07 20:35 ` Joseph Myers
2022-02-08 22:30 Wilco Dijkstra
2022-02-08 23:00 ` Adhemerval Zanella
2022-02-09  0:07   ` Noah Goldstein
2022-02-09  1:42     ` Wilco Dijkstra

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=CAMe9rOrwp2rLidaTqpHn_XjdEpRBGpB8U62pzguMcNN1n31Dow@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.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).