Skip to content

Use wmemchr in stringlib if sizeof(STRINGLIB_CHAR) == sizeof(wchar_t) #93033

Closed
@goldsteinn

Description

@goldsteinn

Feature or enhancement

(A clear and concise description of your proposal.)

memchr is currently used if sizeof(STRINGLIB_CHAR) == sizeof(char) because it faster
than the standard C loops alternatives.

wmemchr has often roughly the same performance as memchr and can be used
in the same way as memchr to speedup some of the string functions STRINGLIB(find_char)
and STRINGLIB(replace_1char_inplace) are the two easiest candidates.

Pitch

(Explain why this feature or enhancement should be implemented and how it would be used.
Add examples, if applicable.)

It would, in some instances, make wide_str.find(wide_str_of_len_one) faster.

Previous discussion

The idea was discussed a bit in #69009 but wasn't the main topic of the issue
or put into any patches.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions