This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Speed up bfd_elf_match_symbols_in_sections
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 2 Feb 2007 06:07:25 -0800
- Subject: Re: [PATCH] Speed up bfd_elf_match_symbols_in_sections
- References: <20060829230012.GA19841@lucon.org> <20070119144609.GI3819@sunsite.mff.cuni.cz> <20070119150524.GJ3819@sunsite.mff.cuni.cz> <20070119152019.GK3819@sunsite.mff.cuni.cz> <20070119175824.GA27882@lucon.org> <20070201201217.GP3819@sunsite.mff.cuni.cz>
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.