mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-07 22:12:08 +00:00
OPTIM: halog: improve field parser speed for modern compilers
Modern compilers were producing producing less efficient code in the field_start() loop, by not emitting two conditional jumps for a single test. However by reordering the test we can merge the optimal case and the default one and get back to good performance so let's simplify the test. This improves the parsing speed by 5%.
This commit is contained in:
parent
fce4e69144
commit
fc76bbc0f5
@ -265,12 +265,10 @@ const char *field_start(const char *p, int field)
|
||||
/* skip spaces */
|
||||
while (1) {
|
||||
c = *(p++);
|
||||
if (c > ' ')
|
||||
break;
|
||||
if (c == ' ')
|
||||
continue;
|
||||
if (!c) /* end of line */
|
||||
return p-1;
|
||||
if (c == ' ')
|
||||
continue;
|
||||
/* other char => new field */
|
||||
break;
|
||||
}
|
||||
@ -283,12 +281,10 @@ const char *field_start(const char *p, int field)
|
||||
/* skip this field */
|
||||
while (1) {
|
||||
c = *(p++);
|
||||
if (c == ' ')
|
||||
break;
|
||||
if (c > ' ')
|
||||
continue;
|
||||
if (c == '\0')
|
||||
return p - 1;
|
||||
if (c == ' ')
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user