This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Objcopy: use a hash table for symbol renaming
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Eirik Byrkjeflot Anonsen <eirik at opera dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 14 Jan 2010 06:36:46 -0800
- Subject: Re: [PATCH] Objcopy: use a hash table for symbol renaming
- References: <87oclw2w6s.fsf@opera.com> <alpine.BSF.2.00.0912181733400.56198@dair.pair.com> <87aawt7uvf.fsf@opera.com> <8763744woy.fsf@opera.com>
On Thu, Jan 14, 2010 at 5:56 AM, Eirik Byrkjeflot Anonsen
<eirik@opera.com> wrote:
> Eirik Byrkjeflot Anonsen <eirik@opera.com> writes:
>
>> Nick Clifton <nickc@redhat.com> writes:
>>
>>> Hi Eirik,
>>>
>>>> The attached patch replaces the linked list with a hash table
>>>> implementation.
>>>
>>> Thanks for submitting this patch. ?It is a good idea, but as
>>> Hans-Peter has pointed out it would be better to make use of the
>>> hashing functions that are already implemented in the libiberty
>>> library, rather than creating your own.
>>
>> Fully agreed. ?I just didn't know that libiberty has a hash table
>> implementation. ?I didn't even know that I was allowed to use libiberty
>> in binutils. ?In fact, you could say I know precious little about
>> libiberty :)
>
> 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.)
>
Can you improve hash table implementation in libiberty to get back that 10%?
Thanks.
--
H.J.