[PATCH] gold: reserve up front buckets in comdat/linkonce signatures hash table

Mikolaj Zalewski mikolajz@google.com
Wed Apr 1 16:27:00 GMT 2009


  I haven't yet finished the updated incremental linking patch, but I
have made a simple patch that may be also interesting as it speeds up
the normal case. It gives some 2-3% improvement on my test by
reserving upfront more buckets in the comdat signatures hash
(previously, the linker was spending something like  3% time of time
rehashing it - the final number of signatures was 2/3 of the number of
symbols). The heuristic is similar to the initial symbol table size
heuristic, but with the result 8 times smaller. In my test this has
given an average of 2.5 items per bucket and it seems there was no
need to rehash. Should I test if the numbers are similar in other
programs?
  The patch also fixes the parameter of find_or_add_kept_comdat to
pass string be reference, but I don't know if this makes a big
difference. I have also kept the code printing statistics about the
number of signatures, as I thought this may be interesting for others.

2009-04-01  Mikolaj Zalewski  <mikolajz@google.com>
       * layout.cc (Layout::Layout): reserve buckets up front for
signatures hash.
       (Layout::find_or_add_kept_section): pass string by reference
       (Layout::print stats): print information about the number of
comdat signatures.
       * layout.h (Layout::Layout): pass Command_line.
       (Layout::find_or_add_kept_section): pass string by reference
       * main.cc (main): pass Command_line to Layout::Layout.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gold-reserve-up-front-more-buckets-in-comdat-signat.patch
Type: text/x-diff
Size: 3525 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20090401/c54d9c5a/attachment.bin>


More information about the Binutils mailing list