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

Florian Weimer fweimer@redhat.com
Mon Feb 7 10:40:53 GMT 2022


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

Thanks,
Florian



More information about the Libc-alpha mailing list