Skip to content
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

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

Merged
merged 8 commits into from
May 21, 2024

Conversation

corona10
Copy link
Member

@corona10 corona10 commented May 17, 2024

@corona10 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 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 corona10 requested review from colesbury and mpage May 17, 2024 06:48
@corona10 corona10 marked this pull request as ready for review May 17, 2024 06:48
Objects/listobject.c Outdated Show resolved Hide resolved
@corona10 corona10 requested a review from mpage May 18, 2024 10:16
Copy link
Contributor

@mpage mpage left a comment

Choose a reason for hiding this comment

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

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.

Objects/listobject.c Outdated Show resolved Hide resolved
@colesbury colesbury added needs backport to 3.13 bugs and security fixes labels May 20, 2024
@corona10 corona10 merged commit ab4263a into python:main May 21, 2024
39 checks passed
@miss-islington-app
Copy link

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 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
Copy link

bedevere-app bot commented May 21, 2024

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

@bedevere-app 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>
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