Skip to content

Commit

Permalink
when needle is short, Sunday algorithm is slower than glibc memchr()
Browse files Browse the repository at this point in the history
  • Loading branch information
takekoshinet committed Sep 18, 2016
1 parent 925c251 commit 1573567
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Zend/zend_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ zend_memnstr(const char *haystack, const char *needle, size_t needle_len, const
return NULL;
}

if (EXPECTED(off_s < 1024 || needle_len < 3)) {
if (EXPECTED(off_s < 1024 || needle_len < 9)) { /* glibc memchr is faster when needle is too short */
end -= needle_len;

while (p <= end) {
Expand Down

0 comments on commit 1573567

Please sign in to comment.