[php-src] PR #24087: ext/standard: Optimize single-character searches in strcspn() and strpbrk()
| From: | LamentXU123 | Date: | Sat, 03 Oct 2026 08:00:40 +0000 |
| Subject: | [php-src] PR #24087: ext/standard: Optimize single-character searches in strcspn() and strpbrk() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39097@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24087
Author: LamentXU123
When I was optimizing str_repeat last month there is a logic inside it:
https://github.com/php/php-src/blob/fab508fe1ca8e89d5ae16bf1cac31d07576462ee/ext/standard/string.c#L5648-L5651
```
if (ZSTR_LEN(input_str) == 1) {
memset(ZSTR_VAL(result), *ZSTR_VAL(input_str), mult);
}
```
Today when reading this piece of code I realize same stuff can be applied on these two functions.