This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 2/2] Simplify the psymbol hash function
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Sat, 4 Nov 2017 10:13:56 -0600
- Subject: [RFA 2/2] Simplify the psymbol hash function
- Authentication-results: sourceware.org; auth=none
- References: <20171104161356.17565-1-tom@tromey.com>
This patch simplifies the psymbol_hash function, by changing it not to
examine the contents of the symbol's name. This change just mirrors
what psymbol_compare already does -- it is checking for name equality,
which is presumably ok because symbol names are generally interned.
This change speeds up psymbol reading. "gdb -nx -batch gdb"
previously took ~1.8 seconds on my machine, and with this patch it now
takes ~1.7 seconds.
gdb/ChangeLog
2017-11-04 Tom Tromey <tom@tromey.com>
* psymtab.c (psymbol_hash): Do not hash string contents.
---
gdb/ChangeLog | 4 ++++
gdb/psymtab.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index f848990867..d22f70a0c0 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1515,7 +1515,7 @@ psymbol_hash (const void *addr, int length)
h = hash_continue (&lang, sizeof (unsigned int), h);
h = hash_continue (&domain, sizeof (unsigned int), h);
h = hash_continue (&theclass, sizeof (unsigned int), h);
- h = hash_continue (psymbol->ginfo.name, strlen (psymbol->ginfo.name), h);
+ h = hash_continue (&psymbol->ginfo.name, sizeof (psymbol->ginfo.name), h);
return h;
}
--
2.13.6