This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Replace the linear search in find_pc_sect_line with a binary search.
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Tue, 20 Mar 2018 10:14:04 -0400
- Subject: [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.
- Follow-Ups:
- *** COMPILATION FAILED *** Failures on Fedora-i686, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Fedora-x86_64-m64, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Fedora-x86_64-native-gdbserver-m32, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Fedora-x86_64-m32, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Fedora-s390x-m64, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Fedora-x86_64-native-extended-gdbserver-m32, branch master *** BREAKAGE ***
- Failures on RHEL-s390x-m64, branch master
- *** COMPILATION FAILED *** Failures on Fedora-x86_64-cc-with-index, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Fedora-x86_64-native-extended-gdbserver-m64, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Fedora-x86_64-native-gdbserver-m64, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Fedora-x86_64-w64-mingw32, branch master *** BREAKAGE ***
- Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, branch master
- Failures on Ubuntu-AArch64-native-gdbserver-m64, branch master
- Failures on Ubuntu-AArch32-m32, branch master
- Failures on Ubuntu-AArch64-m64, branch master