mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -21,6 +21,10 @@
|
|||
#define STRINGLIB_CHECK PyUnicode_Check
|
||||
#define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact
|
||||
#define STRINGLIB_MUTABLE 0
|
||||
#if SIZEOF_WCHAR_T == 2
|
||||
#define STRINGLIB_FAST_MEMCHR(s, c, n) \
|
||||
(Py_UCS2 *)wmemchr((const wchar_t *)(s), c, n)
|
||||
#endif
|
||||
|
||||
#define STRINGLIB_TOSTR PyObject_Str
|
||||
#define STRINGLIB_TOASCII PyObject_ASCII
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue