* [patch] Get rid of inner-loop call to bfd_octets_per_byte in objdump
@ 2009-08-22 15:45 Cary Coutant
2009-08-24 8:47 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: Cary Coutant @ 2009-08-22 15:45 UTC (permalink / raw)
To: Binutils
While profiling objdump, I found a call to bfd_octets_per_byte from
find_symbol_for_address, which seems wasteful given that the value is
already available in the info structure. Calling bfd_octets_per_byte
resuls in a call to bfd_lookup_arch for just about every line of
disassembly, which can be expensive especially if multiple targets are
enabled. This simple change cut 40% off the time it took to do an
objdump -d of a large binary when configured with
--enable-targets=all. (Of course, the savings will be substantially
less with only one or two targets enabled, but I still observed ~4%
improvement with just 2 targets -- i386 and x86 -- enabled.)
OK?
-cary
* objdump.c (find_symbol_for_address): Avoid costly call to
bfd_octets_per_byte.
Index: objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.162
diff -u -p -r1.162 objdump.c
--- objdump.c 27 Jul 2009 17:08:03 -0000 1.162
+++ objdump.c 21 Aug 2009 23:15:26 -0000
@@ -747,7 +747,7 @@ find_symbol_for_address (bfd_vma vma,
aux = (struct objdump_disasm_info *) info->application_data;
abfd = aux->abfd;
sec = aux->sec;
- opb = bfd_octets_per_byte (abfd);
+ opb = info->octets_per_byte;
/* Perform a binary search looking for the closest symbol to the
required value. We are searching the range (min, max]. */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Get rid of inner-loop call to bfd_octets_per_byte in objdump
2009-08-22 15:45 [patch] Get rid of inner-loop call to bfd_octets_per_byte in objdump Cary Coutant
@ 2009-08-24 8:47 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2009-08-24 8:47 UTC (permalink / raw)
To: Cary Coutant; +Cc: Binutils
On Fri, Aug 21, 2009 at 04:34:26PM -0700, Cary Coutant wrote:
> * objdump.c (find_symbol_for_address): Avoid costly call to
> bfd_octets_per_byte.
OK.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-08-24 7:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-22 15:45 [patch] Get rid of inner-loop call to bfd_octets_per_byte in objdump Cary Coutant
2009-08-24 8:47 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).