[PATCH] Speed up bfd_elf_match_symbols_in_sections
H. J. Lu
hjl@lucon.org
Fri Feb 2 14:08:00 GMT 2007
On Thu, Feb 01, 2007 at 09:12:17PM +0100, Jakub Jelinek wrote:
> On Fri, Jan 19, 2007 at 09:58:24AM -0800, H. J. Lu wrote:
> > > BTW, unless you plan to reuse elf_tdata (bfd)->symbuf in some other
> > > place, bfd_elf_match_symbols_in_sections only ever looks at
> > > st_info, st_other, st_shndx st_name of the internal symbols.
> > > So to save memory, you can very well also just save that data and
> > > nothing else (nor the undef symbols and save more than 50% of memory on
> > > this).
> >
> > I can't reproduce
> >
> > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=223181
> >
> > with the current binutils in CVS. I believe the Linux binutils
> > 2.17.50.0.9 is also OK. We can certainly improve it further. But
> > I don't believe it is a major problem.
>
> Here is what I had in mind.
>
> On the mozilla libgtklayout.so testcase (elf_i386) I measured following
> speedups:
>
> 2007-02-01 Jakub Jelinek <jakub@redhat.com>
>
> * elf-bfd.h (struct elf_obj_tdata): Change symbuf type to void *.
> * elf.c (struct elf_symbuf_symbol, struct elf_symbuf_head): New types.
> (struct elf_symbol): Change first member into union.
> (elf_sort_elf_symbol): Compare pointers to internal syms rather than
> internal syms. Only compare st_shndx fields.
> (elf_create_symbuf): New function.
> (bfd_elf_match_symbols_in_sections): Use it. If symbufs are available
> for bfds, use a binary search, otherwise don't qsort symbols
> unnecessarily only to select which symbols are for the particular
> shndx.
>
It looks good to me.
Thanks.
H.J.
More information about the Binutils
mailing list