com php-src: when needle is short, Sunday algorithm is slower than glibc memchr(): Zend/zend_operators.h
| From: | Xinchen Hui | Date: | Sun, 18 Sep 2016 06:46:40 +0000 |
| Subject: | com php-src: when needle is short, Sunday algorithm is slower than glibc memchr(): Zend/zend_operators.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94580@lists.php.net to get a copy of this message | ||
Commit: 15735678c32c41a4602f696e36f0aa7136bd66fd
Author: TAKEKOSHI Akishige <akishige@takekoshi.net> Sun, 18 Sep 2016 15:46:40 +0900
Parents: 925c251c7b29a14650203bed1306516ca7511782
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=15735678c32c41a4602f696e36f0aa7136bd66fd
Log:
when needle is short, Sunday algorithm is slower than glibc memchr()
Changed paths:
M Zend/zend_operators.h
Diff:
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index 2525ebc..7fc11cc 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -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) {