This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 1/2] Speed up dict_hash
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Wed, 8 Nov 2017 10:46:29 +0000
- Subject: Re: [RFA 1/2] Speed up dict_hash
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4D19715447
- References: <20171104161356.17565-1-tom@tromey.com> <20171104161356.17565-2-tom@tromey.com>
On 11/04/2017 04:13 PM, Tom Tromey wrote:
> 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.
Nice!
> + 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;
This looks good to me.
OOC, did you check whether
'if (strcmp (string + 1, "KB") == 0)'
or even:
if (string[1] == 'K' && string[2] == 'B' && string[3] == '\0')
made a difference?
Maybe there aren't enough 'T's in symbols to matter, or the
compiler is already inlining that strcmp...
Thanks,
Pedro Alves