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

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 02:10:58 PST 2018


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

George.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.patch
Type: application/octet-stream
Size: 134231 bytes
Desc: patch.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180125/3220b031/attachment-0001.obj>


More information about the llvm-commits mailing list