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

gh-117431: Adapt str.{start,end}swith to use the METH_FASTCALL calling convention by erlend-aasland · Pull Request #117466 · python/cpython · GitHub

Repository navigation

gh-117431: Adapt str.{start,end}swith to use the METH_FASTCALL calling convention - #117466

Merged
erlend-aasland merged 6 commits into
python:mainfrom
erlend-aasland:perf/starwith
Apr 3, 2024
Merged

erlend-aasland merged 6 commits into
python:mainfrom
erlend-aasland:perf/starwith

Conversation

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

Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor Author

cc. faster-cpython/ideas#671

erlend-aasland changed the title Draft: adapt str.{start,end}swith to Argument Clinic gh-117431: Adapt str.{start,end}swith to use the METH_FASTCALL calling convention Apr 2, 2024
erlend-aasland marked this pull request as ready for review April 2, 2024 15:37

Copy link
Copy Markdown
Contributor Author
# main
$ ./python.exe -m timeit -s "s = 'abcdef'" "s.startswith('abc')"
5000000 loops, best of 5: 89.1 nsec per loop

# this PR
$ ./python.exe -m timeit -s "s = 'abcdef'" "s.startswith('abc')"
10000000 loops, best of 5: 26.4 nsec per loop

erlend-aasland commented Apr 2, 2024 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

We'll also want to convert str.find and friend and finally get rid of the parsing helper in strlib. However, that is best left to a follow-up PR (#117468). I prefer small and incremental changes.

Comment thread Objects/unicodeobject.c Outdated

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @JelleZijlstra and @eendebakpt. I'll hold off merging for a day or two.

erlend-aasland commented Apr 3, 2024 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

Well, with two core devs approving, I'll go ahead and merge. Thanks for the reviews.

erlend-aasland merged commit 444156e into python:main Apr 3, 2024
erlend-aasland deleted the perf/starwith branch April 3, 2024 07:11
Comment thread Objects/unicodeobject.c

vstinner commented Apr 4, 2024

Copy link
Copy Markdown
Member

Nice optimization!

diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
…inic (python#117466)

This change gives a significant speedup, as the METH_FASTCALL calling
convention is now used.
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.

5 participants


Back | FazBrowse Home | New Git URL