From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Tom Tromey <tromey@adacore.com>,
Andrew Burgess <aburgess@redhat.com>,
Pedro Alves <pedro@palves.net>
Cc: Andreas Arnez <arnez@linux.ibm.com>,
gdb-patches@sourceware.org, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH 0/5] gdb: Store section map in an interval tree
Date: Thu, 2 Jun 2022 15:35:41 +0200 [thread overview]
Message-ID: <20220602133546.2948282-1-iii@linux.ibm.com> (raw)
Hi,
When debugging JITs that report ~10k sections, GDB slows to a crawl,
even with the recent optimization [1]. The problem is that the
algorithmic complexity of adding N new sections is O((N**2)*log(N)),
because the code calls update_section_map() and thus std::sort() N
times.
This series aims to reduce this to O(N*log(N)) by storing sections in
an interval tree and updating it incrementally instead of rebuilding it
every time from scratch. The interval tree is chosen instead of
simpler alternatives in order to handle overlapping sections.
- Patch 1 introduces obstack_newvec() for allocating obj_section
objects, which later become non-POD types.
- Patches 2-3 introduce interval tree implementation and tests for it.
- Patch 5 is the actual optimization.
The performance testing [2] results can be found here: [3].
This series survives the regtest on x86_64, power and s390x.
Best regards,
Ilya
[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=625b6eae091709b95471eae92d42dc6bc71e6553
[2] https://sourceware.org/pipermail/gdb-patches/2022-May/189592.html
[3] https://github.com/iii-i/binutils-gdb/blob/section-map-20220601-2/gdb/testsuite/jit.png
Ilya Leoshkevich (5):
gdbsupport: Introduce obstack_newvec
gdbsupport: Introduce interval_tree
gdbsupport: Add interval_tree unit tests
gdbsupport: Add interval_tree fuzzing harness
gdb: Optimize section map
gdb/Makefile.in | 1 +
gdb/objfiles.c | 384 +++++-----
gdb/objfiles.h | 15 +-
gdb/symfile.c | 2 +-
gdb/unittests/interval_tree-selftests.c | 400 +++++++++++
gdbsupport/gdb_obstack.h | 26 +
gdbsupport/interval_tree.h | 915 ++++++++++++++++++++++++
7 files changed, 1526 insertions(+), 217 deletions(-)
create mode 100644 gdb/unittests/interval_tree-selftests.c
create mode 100644 gdbsupport/interval_tree.h
--
2.35.3
next reply other threads:[~2022-06-02 13:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 13:35 Ilya Leoshkevich [this message]
2022-06-02 13:35 ` [PATCH 1/5] gdbsupport: Introduce obstack_newvec Ilya Leoshkevich
2022-06-02 14:31 ` Tom Tromey
2022-06-02 14:33 ` Ilya Leoshkevich
2022-06-02 13:35 ` [PATCH 2/5] gdbsupport: Introduce interval_tree Ilya Leoshkevich
2022-06-02 14:12 ` Pedro Alves
2022-06-02 14:17 ` Ilya Leoshkevich
2022-06-02 14:12 ` Pedro Alves
2022-06-02 14:37 ` Pedro Alves
2022-06-02 15:09 ` Ilya Leoshkevich
2022-06-02 18:04 ` Tom Tromey
2022-06-02 13:35 ` [PATCH 3/5] gdbsupport: Add interval_tree unit tests Ilya Leoshkevich
2022-06-02 13:35 ` [PATCH 4/5] gdbsupport: Add interval_tree fuzzing harness Ilya Leoshkevich
2022-06-02 13:35 ` [PATCH 5/5] gdb: Optimize section map Ilya Leoshkevich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220602133546.2948282-1-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=aburgess@redhat.com \
--cc=arnez@linux.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
--cc=tromey@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).