[PATCH] Objcopy: use a hash table for symbol renaming

Eirik Byrkjeflot Anonsen eirik@opera.com
Thu Jan 14 16:21:00 GMT 2010


"H.J. Lu" <hjl.tools@gmail.com> writes:

>>> On Thu, Jan 14, 2010 at 5:56 AM, Eirik Byrkjeflot Anonsen
>>> <eirik@opera.com> wrote:
>> [...]
>>>> Ok, I finally got around to spending some time trying to figure out how
>>>> libiberty's hash tables work.  I found the documentation to be somewhat
>>>> thin, so I ended up implementing the symbol redefinition hash table by
>>>> the time-honored coding style of "cut and paste".  (Though the resulting
>>>> code seems sensible.  And it seems to do the right thing.)
>>>>
>>>> (Astonishingly, this version seems to be about 10% slower than mine.
>>>> "Astonishingly" because my version was optimized for correctness and
>>>> readability, not for performance.  Still, it's not a performance
>>>> difference that matters significantly.  The benefits of using a standard
>>>> implementation of hash tables far outweighs that minor performance
>>>> hit.)
[...]
>
> You can choose the hash table size, which makes a big difference
> sometimes.

Ah, I overlooked that one.

Yes, using roughly the same initial size as in my previous version (240)
brings the difference down to around 2.5% (quite stable results, so
that's probably pretty close to the real difference).  (Using an initial
size of 100000 makes this version around 2% faster than my old one.)

Using an initial size of 240 seems like a reasonable idea.  Should I
post an updated patch with that change?

eirik



More information about the Binutils mailing list