Feature or enhancement
Proposal:
memcmp is being used in /Objects/stringlib/eq.h.
It can also be used as a fast path when 2 strings are of the same size for str.find and str.count.
PYMAIN="/Users/Edu/local/code/cpython/main/python.exe"
PYWT1="/Users/Edu/local/code/cpython/wt1/python.exe"
$PYMAIN -m timeit -s 'a = "abc" * 100_000; b = str(a)' 'a.find(b)' # 273 µs
$PYWT1 -m timeit -s 'a = "abc" * 100_000; b = str(a)' 'a.find(b)' # 11 µs
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
memcmpis being used in/Objects/stringlib/eq.h.It can also be used as a fast path when 2 strings are of the same size for
str.findandstr.count.Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
str.findequal length fast path #155556