GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use shared helper function for faster index range checks · Issue #120176 · python/cpython

Use shared helper function for faster index range checks #120176

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Use shared helper function for faster index range checks#120176
Copy link

Description

@lgeiger
lgeiger
opened on Jun 6, 2024
Issue body actions

#9784 (discussed in #72583 and #67741) introduced a helper function to reduce the number of comparisons in list index range checks (see https://godbolt.org/z/jM8oexT1d).

The same pattern can be applied in many other places in the code base like in arraymodule.c, mmapmodule.c, bytearrayobject.c, etc.

I'd propose to extract this helper function into a header and start using it in more places for index range checks. internal/pycore_abstract.h seems like it might be a decent place to put this helper in.

I'm happy to make a PR if people think a micro optimisation like this justifies the code churn, but let me know if I'm missing something.

Linked PRs

  • gh-120176: Reduce number of compares in index range checks #120181

Activity

  1. serhiy-storchaka commented on Jun 8, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on Jun 8, 2024
    Member
    More actions

    This is a duplicate of #72583. This idea was already rejected.

  2. serhiy-storchaka
    closed this as not plannedon Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.