FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-117431: Adapt str.find and friends to use the METH_FASTCALL calling convention by erlend-aasland · Pull Request #117468 · python/cpython · GitHub

Repository navigation

gh-117431: Adapt str.find and friends to use the METH_FASTCALL calling convention - #117468

Merged
erlend-aasland merged 20 commits into
python:mainfrom
erlend-aasland:perf/str.find-and-friends
Apr 3, 2024
Merged

erlend-aasland merged 20 commits into
python:mainfrom
erlend-aasland:perf/str.find-and-friends

Conversation

erlend-aasland commented Apr 2, 2024 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

erlend-aasland marked this pull request as ready for review April 3, 2024 07:15

Copy link
Copy Markdown
Contributor Author

Similar speedsups as with str.startswith and str.endswith:

# main
$ ./python.exe -m timeit -s "s = 'abcdef'" "s.count('a')"
5000000 loops, best of 5: 92.5 nsec per loop

# This PR
$ ./python.exe -m timeit -s "s = 'abcdef'" "s.count('a')"
10000000 loops, best of 5: 26.2 nsec per loop

Copy link
Copy Markdown
Contributor Author

Thanks for the review, Inada-san.

erlend-aasland merged commit 7ecd55d into python:main Apr 3, 2024
erlend-aasland deleted the perf/str.find-and-friends branch April 3, 2024 15:59
erlend-aasland added a commit to erlend-aasland/cpython that referenced this pull request Apr 6, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL