public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: John Baldwin <jhb@FreeBSD.org>
Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH 00/19] Add hash table to gdbsupport
Date: Fri, 03 Nov 2023 12:54:45 -0600	[thread overview]
Message-ID: <87h6m2is5m.fsf@tromey.com> (raw)
In-Reply-To: <31427308-7225-4aee-7b57-25c0fd06954c@FreeBSD.org> (John Baldwin's message of "Mon, 10 Apr 2023 12:45:50 -0700")

>>>>> "John" == John Baldwin <jhb@FreeBSD.org> writes:

John> On 4/7/23 8:25 AM, Tom Tromey wrote:
>> I recently read an article about hash tables and was inspired to write
>> a new one for gdb.  I haven't converted all the libiberty htab uses in
>> gdb, but this series does change enough of them to, I think, show that
>> the new implementation is workable.
>> The benefits of this approach are explained in the first patch.
>> Regression tested on x86-64 Fedora 36.  This found a latent bug in
>> one
>> use of htab_t, see the typedefs patch.
>> Let me know what you think.

John> I just have one possibly naive question which is why not use
John> std::unordered_map<> directly in the various callers?  At least, I think
John> it might be useful to explain why GDB includes a bespoke hash table now
John> that we require C++11, it was more obvious I think when GDB was still
John> written in C.

std::unordered_map has some issues.  They may not affect every spot
using hash tables in gdb, but they probably affect some of them.

unordered_map is necessarily a chained hash table, not an open addressed
hash table.  And, it has to allocate nodes for entries, because it
promises pointer stability.  So, it has higher overhead than the hash
table in this series.

Also, I don't think there's a way to use one type as the key in
unordered_map but do lookups using a different type.  gdb uses this in
some places.

I'll add some text to this effect to patch #1.

Tom

  reply	other threads:[~2023-11-03 18:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 15:25 Tom Tromey
2023-04-07 15:25 ` [PATCH 01/19] Add a " Tom Tromey
2023-04-07 15:41   ` Tom Tromey
2023-04-07 15:25 ` [PATCH 02/19] Convert compile-c-symbols.c to new hash table Tom Tromey
2023-04-07 15:25 ` [PATCH 03/19] Convert filename-seen-cache.h " Tom Tromey
2023-04-07 15:25 ` [PATCH 04/19] Convert linespec.c " Tom Tromey
2023-04-07 15:25 ` [PATCH 05/19] Convert target-descriptions.c " Tom Tromey
2023-04-07 15:25 ` [PATCH 06/19] Convert dwarf2/macro.c " Tom Tromey
2023-04-07 15:25 ` [PATCH 07/19] Convert breakpoint.c " Tom Tromey
2023-04-07 15:25 ` [PATCH 08/19] Convert py-framefilter.c " Tom Tromey
2023-04-07 15:25 ` [PATCH 09/19] Convert disasm.c " Tom Tromey
2023-04-07 15:25 ` [PATCH 10/19] Convert compile/compile.c " Tom Tromey
2023-04-07 15:25 ` [PATCH 11/19] Convert type copying " Tom Tromey
2023-04-07 15:25 ` [PATCH 12/19] Convert static links " Tom Tromey
2023-04-07 15:25 ` [PATCH 13/19] Convert gnu-v3-abi.c " Tom Tromey
2023-04-07 15:25 ` [PATCH 14/19] Convert abbrev cache " Tom Tromey
2023-04-07 15:25 ` [PATCH 15/19] Convert abbrevs " Tom Tromey
2023-04-07 15:25 ` [PATCH 16/19] Convert typedef hash " Tom Tromey
2023-04-07 15:25 ` [PATCH 17/19] Convert all_bfds " Tom Tromey
2023-04-07 15:25 ` [PATCH 18/19] Convert more DWARF code " Tom Tromey
2023-04-07 15:25 ` [PATCH 19/19] Convert gdb_bfd.c " Tom Tromey
2023-04-10 19:45 ` [PATCH 00/19] Add hash table to gdbsupport John Baldwin
2023-11-03 18:54   ` Tom Tromey [this message]
2023-12-08 18:28 ` Tom Tromey
2024-01-11 18:07   ` Tom Tromey
2024-01-11 19:35     ` John Baldwin
2024-01-12  2:57     ` Simon Marchi
2024-01-12 18:22       ` Tom Tromey
2024-01-12 19:12         ` Simon Marchi

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=87h6m2is5m.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    /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).