This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Another linker performance issue
- From: John Reiser <jreiser at bitwagon dot com>
- To: binutils at sourceware dot org
- Date: Thu, 01 Mar 2012 21:13:54 -0800
- Subject: Re: Another linker performance issue
- References: <4F4E427E.7040603@obry.net> <4F4E557D.5040206@bitwagon.com> <4F4FD62F.1060102@obry.net>
> Sadly not 20% :( I've tested with your patch and the performance
> increase is only 3% that is we gain 1s (from 36.9s to 35.9s) in my small
> test.
Thank you for the synthetic test code.
The original profile showed an average of 1991171953 / 12871 = 154702
calls to pe_undef_alias_cdecl_match per call to bfd_link_hash_traverse.
There are about 150K symbols, right?
The next thing to try might be a new routine bfd_link_hash_traverse_undefined(),
which would hoist the filter "if (h->type == bfd_link_hash_undefined)"
into the traversal, avoiding the call to the parametric subroutine
when a symbol is defined.
Another idea, more along the lines of different global strategy:
Do the calls to pe_find_cdecl_alias_match() come in batches,
such as all the symbols needing alias resolution are checked together?
Then for each batch, build an array of pointers to the undefined symbols only.
Run bfd_link_hash_traverse() once to just count the undefined symbols;
allocate an array of that many pointers. Then run bfd_link_hash_traverse()
again, filling in the array. Now do an entire batch of alias matching
on the array of undefined symbols. Then free() the array of pointers.
--