[PATCH] Improve objdump -S performance

Alan Modra amodra@bigpond.net.au
Mon Apr 27 02:05:00 GMT 2009


On Sun, Apr 26, 2009 at 05:27:02PM +0200, Andi Kleen wrote:
> objdump -S runs really slow (as in hours cpu time) compared to objdump -d 
> on large ELF files without debug information. Profiling shows nearly
> all the time is spent in elf_find_function, which is called
> as a fallback for the failing dwarf2 line lookup. elf_find_function
> goes through all the symbols and since objdump calls that
> for every instruction that's really slow.
> 
> One possibility to fix that would have been to use a better
> data structure instead of an array for the symbols, 
> or at least do a binary search on a sorted array, but
> that would all have needed new entry points in bfd and other
> complications.
> 
> I ended up implementing this simple last hit cache. With
> that objdump -S on the debug info less file is still factor ~3
> slower than -d, but at least it's bearable now compared
> to -d.

I think this will return incorrect results.  Given a file with more
than one function in a section, won't you stay stuck returning the
lowest function symbol when disassembling the section?

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list