This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 1/2] Speed up dict_hash


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]