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

GH-132554: Add stats for GET_ITER by markshannon · Pull Request #132592 · python/cpython · GitHub

/ cpython Public

GH-132554: Add stats for GET_ITER - #132592

Merged
markshannon merged 3 commits into
python:mainfrom
faster-cpython:get-iter-stats
Apr 29, 2025
Merged

GH-132554: Add stats for GET_ITER#132592
markshannon merged 3 commits into
python:mainfrom
faster-cpython:get-iter-stats

Conversation

markshannon commented Apr 16, 2025
edited
Loading

Copy link
Copy Markdown
Member

Before we can specialize GET_ITER, or even decide if it is worth specializing GET_ITER, we need stats.

Copy link
Copy Markdown
Member

I bet a lot of the "other" will already be iterators. It may be worth adding a stat at the end, before "other", for types where tp->tp_iter == PyObject_SelfIter. At least for that case we can specialize it and do nothing.

(I wish we could also "unwrap" list, tuple, and range iterators, similar in spirit to our method call optimization. Basically, if GET_ITER encounters a list_iterator, range_iterator, or tuple_iterator we just put the container itself and the current index on the stack. But that's not safe to do if its refcount is greater than one, unfortunately.)

markshannon merged commit 622300b into python:main Apr 29, 2025
markshannon deleted the get-iter-stats branch April 29, 2025 08:00
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL