-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Improve performance of startswith, endswith, count, *find, and *index methods for str, bytes and bytearray #117431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
…117466) This change gives a significant speedup, as the METH_FASTCALL calling convention is now used.
Conversion of bytes/bytearray Footnotes |
The first parameter is named 'suffix', not 'prefix'. Regression introduced by commit 444156e
… Argument Clinic (#117495) This change gives a significant speedup, as the METH_FASTCALL calling convention is now used.
This change gives a significant speedup, as the METH_FASTCALL calling convention is now used. The following methods are adapted: - str.count - str.find - str.index - str.rfind - str.rindex
Nice work so far! Would be good to put these in What's New, perhaps under https://docs.python.org/3.13/whatsnew/3.13.html#optimizations. Can be done later, when closing the issue. |
…Clinic (#117502) This change gives a significant speedup, as the METH_FASTCALL calling convention is now used. The following bytes and bytearray methods are adapted: - count() - find() - index() - rfind() - rindex() Co-authored-by: Inada Naoki <songofacandy@gmail.com>
…inic (python#117466) This change gives a significant speedup, as the METH_FASTCALL calling convention is now used.
The first parameter is named 'suffix', not 'prefix'. Regression introduced by commit 444156e
…h() to Argument Clinic (python#117495) This change gives a significant speedup, as the METH_FASTCALL calling convention is now used.
…n#117468) This change gives a significant speedup, as the METH_FASTCALL calling convention is now used. The following methods are adapted: - str.count - str.find - str.index - str.rfind - str.rindex
…ument Clinic (python#117502) This change gives a significant speedup, as the METH_FASTCALL calling convention is now used. The following bytes and bytearray methods are adapted: - count() - find() - index() - rfind() - rindex() Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Feature or enhancement
Proposal:
We can improve performance of
str.startswith
and other methods for the single-argument case by creating a fast path in the single argument parsing.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
faster-cpython/ideas#671
Linked PRs
The text was updated successfully, but these errors were encountered: