This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug middle-end/84029] New: Partially inline strcmp


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84029

            Bug ID: 84029
           Summary: Partially inline strcmp
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wilco at gcc dot gnu.org
  Target Milestone: ---

Initial performance results for PR78809 suggest that partial inlining of strcmp
may be beneficial. We could inline the first character comparison before
calling strcmp:

if ((res = s[0] - t[0]) == 0)
  res = strcmp (s, t);

Such a check would have low overhead and improve performance if the first
character often mismatches. Checking for more characters is possible, but would
have a higher overhead. strncmp and memcmp could do something similar.

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