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.