← 返回首页
gh-119053: Implement the fast path for list.__getitem__ by corona10 · Pull Request #119112 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-119053: Implement the fast path for list.__getitem__#119112

Merged
corona10 merged 8 commits into
python:mainfrom
corona10:gh-119053
May 21, 2024
Merged

gh-119053: Implement the fast path for list.__getitem__#119112
corona10 merged 8 commits into
python:mainfrom
corona10:gh-119053

Conversation

corona10 commented May 17, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

corona10 changed the title gh-119053: Implement the fast path for list.__getitem__ [WIP] gh-119053: Implement the fast path for list.__getitem__ May 17, 2024
corona10 changed the title [WIP] gh-119053: Implement the fast path for list.__getitem__ gh-119053: Implement the fast path for list.__getitem__ May 17, 2024
corona10 requested review from colesbury and mpage May 17, 2024 06:48
corona10 marked this pull request as ready for review May 17, 2024 06:48
Comment thread Objects/listobject.c Outdated Show resolved Hide resolved
Comment thread Objects/listobject.c Show resolved Hide resolved
corona10 requested a review from mpage May 18, 2024 10:16

mpage left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

This looks good to me. I noticed that we perform a validity check on the index several times now:

  1. In list_item
  2. In list_get_item_ref
  3. In list_item_impl (if we end up taking the slow path)

While this doesn't affect correctness, I think it would make sense to refactor the code to eliminate the redundant checks given how performance sensitive this code is. That could be tackled in a separate PR, though.

Comment thread Objects/listobject.c Outdated Show resolved Hide resolved
colesbury added needs backport to 3.13 bugs and security fixes labels May 20, 2024
corona10 merged commit ab4263a into python:main May 21, 2024

Copy link
Copy Markdown

Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

corona10 deleted the gh-119053 branch May 21, 2024 13:49
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 21, 2024
…gh-119112) (cherry picked from commit ab4263a) Co-authored-by: Donghee Na <donghee.na@python.org>

bedevere-app Bot commented May 21, 2024

Copy link
Copy Markdown

GH-119309 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label May 21, 2024
corona10 added a commit that referenced this pull request May 21, 2024
…9112) (gh-119309) gh-119053: Implement the fast path for list.__getitem__ (gh-119112) (cherry picked from commit ab4263a) Co-authored-by: Donghee Na <donghee.na@python.org>
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

Footer

© 2026 GitHub, Inc.