From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 1/2] Speed up dict_hash
Date: Sat, 04 Nov 2017 16:14:00 -0000 [thread overview]
Message-ID: <20171104161356.17565-2-tom@tromey.com> (raw)
In-Reply-To: <20171104161356.17565-1-tom@tromey.com>
This speeds up dict_hash a bit, by moving the "TKB" check into the
switch in the loop.
For "gdb -nx -readnow -batch gdb", this improves the time from ~9.8s
before to ~8.5s afterward.
gdb/ChangeLog
2017-11-04 Tom Tromey <tom@tromey.com>
* dictionary.c (dict_hash): Move "TKB" check into the "switch".
---
gdb/ChangeLog | 4 ++++
gdb/dictionary.c | 32 ++++++++++++++++----------------
2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index b2cfca28ab..702cd60c2a 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -796,17 +796,6 @@ dict_hash (const char *string0)
hash = 0;
while (*string)
{
- /* Ignore "TKB" suffixes.
-
- These are used by Ada for subprograms implementing a task body.
- For instance for a task T inside package Pck, the name of the
- subprogram implementing T's body is `pck__tTKB'. We need to
- ignore the "TKB" suffix because searches for this task body
- subprogram are going to be performed using `pck__t' (the encoded
- version of the natural name `pck.t'). */
- if (strcmp (string, "TKB") == 0)
- return hash;
-
switch (*string)
{
case '$':
@@ -828,14 +817,25 @@ dict_hash (const char *string0)
return hash;
hash = 0;
string += 2;
- break;
+ continue;
}
- /* FALL THROUGH */
- default:
- hash = SYMBOL_HASH_NEXT (hash, *string);
- string += 1;
+ break;
+ case 'T':
+ /* Ignore "TKB" suffixes.
+
+ These are used by Ada for subprograms implementing a task body.
+ For instance for a task T inside package Pck, the name of the
+ subprogram implementing T's body is `pck__tTKB'. We need to
+ ignore the "TKB" suffix because searches for this task body
+ subprogram are going to be performed using `pck__t' (the encoded
+ version of the natural name `pck.t'). */
+ if (strcmp (string, "TKB") == 0)
+ return hash;
break;
}
+
+ hash = SYMBOL_HASH_NEXT (hash, *string);
+ string += 1;
}
return hash;
}
--
2.13.6
next prev parent reply other threads:[~2017-11-04 16:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-04 16:14 [RFA 0/2] some minor symbol-reading performance improvements Tom Tromey
2017-11-04 16:14 ` [RFA 2/2] Simplify the psymbol hash function Tom Tromey
2017-11-08 11:12 ` Pedro Alves
2017-11-08 11:42 ` Pedro Alves
2017-11-08 19:08 ` Tom Tromey
2017-11-09 14:09 ` Tom Tromey
2017-11-09 14:10 ` Pedro Alves
2017-11-04 16:14 ` Tom Tromey [this message]
2017-11-08 10:46 ` [RFA 1/2] Speed up dict_hash Pedro Alves
2017-11-08 18:44 ` Tom Tromey
2017-11-08 22:41 ` Pedro Alves
2017-11-08 23:01 ` Tom Tromey
2017-11-08 23:51 ` Pedro Alves
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=20171104161356.17565-2-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.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