This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Improve objdump -S performance
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Andi Kleen <andi at firstfloor dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 27 Apr 2009 11:34:35 +0930
- Subject: Re: [PATCH] Improve objdump -S performance
- References: <20090426152702.GA19825@basil.nowhere.org>
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