[PATCH] D41993: [ELF] - Change shift2 constant of GNU_HASH from 6->11.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 15:10:39 PST 2018


George Rimar <grimar at accesssoftek.com> writes:

>>This is not what I meant by most 0 or must 1. Instead of adding to Score
>>every time there is a collision, what I had in mind was to just count
>>the number of 1 bits in the Bloom std::vector:
>>
>>unsigned GnuHashTableSection::findShift2Score(size_t Shift) const {
>>  unsigned C = Config->Is64 ? 64 : 32;
>>  std::vector<uint64_t> Bloom(MaskWords);
>>  for (const Entry &Sym : Symbols) {
>>    uint64_t &Value = Bloom[(Sym.Hash / C) & (MaskWords - 1)];
>>
>>    uint64_t Bit1 = uint64_t(1) << (Sym.Hash % C);
>>    Value |= uint64_t(1) << (Sym.Hash % C);
>>
>>   uint64_t Bit2 = uint64_t(1) << ((Sym.Hash >> Shift) % C);
>>    Value |= Bit2;
>>  }
>>  unsigned Score = 0;
>>  for (uint64_t V : Bloom)
>>    Score += numberOfSetBits(V);
>>  return Score;
>>}
>
> Retested with this suggestion (patch is attached).
> Results are the same though. Setting more bits show better time.
>
> LLD head: 407.74s, 407.56s.
> With patch (MaximizeBits == true, default): 399.0s, 398.92s.
> With patch (MaximizeBits == false): 415.92s, 416.07s.

Thanks!

That is pretty crazy unintuitive. I guess some profiling or statistics
in the dynamic linker is needed to understand it.

Cheers,
Rafael


More information about the llvm-commits mailing list