Add fast path for ". " in match_urls.

GitOrigin-RevId: 306419ea1e076f527e924721ef6caa4347c955ff
This commit is contained in:
levlam 2020-03-10 17:53:55 +03:00
parent 83cf2b3dd1
commit 08a5f1b874

View File

@ -528,9 +528,15 @@ static vector<Slice> match_urls(Slice str) {
while (true) {
auto dot_pos = str.find('.');
if (dot_pos > str.size()) {
if (dot_pos > str.size() || dot_pos + 1 == str.size()) {
break;
}
if (str[dot_pos + 1] == ' ') {
// fast path
str = str.substr(dot_pos + 2);
begin = str.ubegin();
continue;
}
const unsigned char *last_at_ptr = nullptr;
const unsigned char *domain_end_ptr = begin + dot_pos;