[PATCH] D45571: [ELF] - Speedup MergeInputSection::splitStrings

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 13 11:18:59 PDT 2018


espindola added a comment.

OK,

> No much difference for me:
> 
>   Function Name                                   Total CPU(%) Total CPU (ms)
>   
>   * After the change:
>   - lld.exe (PID: 15032)                          100.00        4166
>    + lld::elf::MergeInputSection::splitIntoPieces  22.40         933
>   
>   * Default (xxHash64):
>   - lld.exe                                         100.00%        4254
>    + lld::elf::MergeInputSection::splitStrings       21.86%         930

On the description you report that just using gnuHash is 4469, so I think some reasonable hypothesis so far:

- Reading the value only once is a good improvement.
- Reading a byte at a time is a noticeable lost.

so it would probably be ideal to combine some of the memchr tricks for reading multiple bytes at a time with a simpleish hash that can combine more than one char at a time.

It should also be possible to template Hash.h over the returned type so that some clients can explicitly request a 32 or 64 bit hash. Not sure if that change would be accepted.


https://reviews.llvm.org/D45571





More information about the llvm-commits mailing list