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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 13 01:24:02 PDT 2018


grimar added a comment.

In https://reviews.llvm.org/D45571#1066162, @espindola wrote:

> I just noticed that hash_short will read at most 64 bytes of the string.
>
> This could cause a pathological case if many symbols have a common prefix, no?


Sure, we will have many hash collisions then, but how much is real?

I see at least 2 good (IMO) solutions for that:

1. One of the options is to use hash_short for short strings only (<64) and fall back to something else otherwise,

but I would give a chance to the current way.

2. Also, we could just pass the 64 bytes from the middle of the string, assuming it covers both the prefix, data itself and postfix.

> One interesting thing about the current setup is that we first read the bytes in the string looking for the 0 that terminates the string. We then read them again to hash them. At least with a simple hash like djb (what is implemented in hashGnu) it should not be too hard to read each byte once. Would you mind giving that a try?

Sure, I'll try.


https://reviews.llvm.org/D45571





More information about the llvm-commits mailing list