[PATCH] elf: Replace memcmp with __memcmpeq for variable size

H.J. Lu hjl.tools@gmail.com
Mon Feb 7 13:13:28 GMT 2022


On Mon, Feb 7, 2022 at 2:41 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> >> benefits come from.  None of the changed spots look particularly hot
> >> to me.
> >
> > These are noises.  Here are the new data:
> >
> > The cycles to run "elf/tst-relsort1 --direct" which calls __memcmpeq
> > 24 times in ld.so:
> >
> > Before:
> >
> >      62704:
> >      62704: runtime linker statistics:
> >      62704:   total startup time in dynamic loader: 130771 cycles
> >      62704:             time needed for relocation: 32153 cycles (24.5%)
> >      62704:                  number of relocations: 97
> >      62704:       number of relocations from cache: 3
> >      62704:         number of relative relocations: 1347
> >      62704:            time needed to load objects: 43704 cycles (33.4%)
> >      62704:
> >      62704: runtime linker statistics:
> >      62704:            final number of relocations: 131
> >      62704: final number of relocations from cache: 3
> >
> > After:
> >
> >      62705:
> >      62705: runtime linker statistics:
> >      62705:   total startup time in dynamic loader: 117103 cycles
> >      62705:             time needed for relocation: 28327 cycles (24.1%)
> >      62705:                  number of relocations: 97
> >      62705:       number of relocations from cache: 3
> >      62705:         number of relative relocations: 1347
> >      62705:            time needed to load objects: 39550 cycles (33.7%)
> >      62705:
> >      62705: runtime linker statistics:
> >      62705:            final number of relocations: 131
> >      62705: final number of relocations from cache: 3
> >
> > These numbers change for each run.  __memcmpeq has the lower
> > cycles.
>
> 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.


-- 
H.J.


More information about the Libc-alpha mailing list