[PATCH 3/6] gprof: speed up line-by-line for MIPS/PowerPC/RISCV/SuperH

Richard Allen rsaxvc@gmail.com
Sun Feb 16 22:50:02 GMT 2025


Roughly halves the number of bfd_find_nearest_line() calls,
about 40% less time for a few different large ELF files.

Signed-off-by: Richard Allen <rsaxvc@gmail.com>
---
 gprof/corefile.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gprof/corefile.c b/gprof/corefile.c
index 47b80e2ded8..2e6952ff775 100644
--- a/gprof/corefile.c
+++ b/gprof/corefile.c
@@ -254,6 +254,13 @@ core_init (const char * aout_name)
       offset_to_code = 2;
       break;
 
+    case bfd_arch_mips:/* and microMIPS */
+    case bfd_arch_powerpc:/* and VLE */
+    case bfd_arch_riscv:/* and RVC */
+    case bfd_arch_sh:
+      gcd_insn_size = 2;
+      break;
+
     case bfd_arch_alpha:
       gcd_insn_size = 4;
       break;
-- 
2.39.5



More information about the Binutils mailing list