overhead of bfd_{get,put}*()

David Miller davem@davemloft.net
Tue Feb 23 06:02:00 GMT 2010


Just for kicks I ran a link I perform often under 'perf'
to see what consumes the most cycles in the BFD based
linker on sparc64.

The test case is a Linux kernel link with every possible config option
enabled as a module.  In the final kernel link there are about 2.8
million relocations for 'ld' to process.

On my Niagara2 build box the link takes ~8.3 seconds.

The top offenders were, surprisingly for me, bfd_getb64(),
bfd_putb64() and bfd_getb_signed_64().  And it's not because they
touch memory, it's the byte loads and shift/or dance they do.

As a quick hack test I simply converted these functions to use direct
assignments and 64-bit pointer derefs.

This trimmed more than a full second off of the execution time for the
test case.  Down to ~7.15s

I don't know what to do about this.  It's a more than %10 performance
hit on this test case.  But I assume that these routines might have
to access potentially unaligned data right?  Unfortunately I was not
able to hit any such case by running the full testsuite, it passed
with my hacks in there :-)

Any comments?



More information about the Binutils mailing list