This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Replace the linear search in find_pc_sect_line with a binary search.


*** TEST RESULTS FOR COMMIT 4ee89e903de920496a69c01df70db13a70a2a0be ***

Author: Stephen Roberts <stephen.roberts@arm.com>
Branch: master
Commit: 4ee89e903de920496a69c01df70db13a70a2a0be

Replace the linear search in find_pc_sect_line with a binary search.

This patch addresses slowness when setting breakpoints, especially in
heavily templatized code. Profiling showed that find_pc_sect_line in
symtab.c was the performance bottleneck.  The original logic performed a
linear search over ordered data. This patch uses a binary search, as
suggested by comments around the function.  There are no behavioural
changes, but gdb is now faster at setting breakpoints in template code.
Tested using on make check on an x86 target. The optimisation speeds up
the included template-breakpoints.py performance test by a factor of 7
on my machine.

ChangeLog:

2018-03-20  Stephen Roberts  <stephen.roberts@arm.com>

        * gdb/symtab.c (find_pc_sect_line): now uses binary search.

gdb/testsuite/

        * gdb.perf/template-breakpoints.cc: New file.
        * gdb.perf/template-breakpoints.exp: New file.
        * gdb.perf/template-breakpoints.py: New file.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]