mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-93033: Use wmemchr in stringlib (GH-93034)
Generally comparable perf for the "good" case where memchr doesn't return any collisions (false matches on lower byte) but clearly faster with collisions.
This commit is contained in:
parent
f7fabae75c
commit
7108bdf27c
11 changed files with 39 additions and 14 deletions
|
@ -29,9 +29,9 @@ STRINGLIB(replace_1char_inplace)(STRINGLIB_CHAR* s, STRINGLIB_CHAR* end,
|
|||
if (!--attempts) {
|
||||
/* if u1 was not found for attempts iterations,
|
||||
use FASTSEARCH() or memchr() */
|
||||
#if STRINGLIB_SIZEOF_CHAR == 1
|
||||
#ifdef STRINGLIB_FAST_MEMCHR
|
||||
s++;
|
||||
s = memchr(s, u1, end - s);
|
||||
s = STRINGLIB_FAST_MEMCHR(s, u1, end - s);
|
||||
if (s == NULL)
|
||||
return;
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue