https://sourceware.org/bugzilla/show_bug.cgi?id=29794

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There is another thing which could be done is do strchr up front to find the
other : and then match the length and not do the strncasecmp in that case.

That is:
static struct reloc_table_entry *
find_reloc_table_entry (char **str)
{
  unsigned int i;
  const char *relocnameinstrend = strchr(*str, ':');
  if (!relocnameinstrend)
    return NULL;

  int reloclengthinstr = *str - relocnameinstrend;
  for (i = 0; i < ARRAY_SIZE (reloc_table); i++)
    {
      int length = reloc_table[i].name_length;
      if (length == -1)
        length = strlen (reloc_table[i].name);
      if (reloclengthinstr != length)
        continue;

      if (strncasecmp (reloc_table[i].name, *str, length) == 0
          && (*str)[length] == ':')
        {
          *str += (length + 1);
          return &reloc_table[i];
        }
    }

  return NULL;
}

----- CUT ----
These two should give a reasonable speed up I think. Also reording the list to
the most used first will also speed it up (I think that is the reason why lo12
is first already).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to