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 — Optimize reference counting overhead of `LOAD_FAST` variants · Issue #130704 · python/cpython

Optimize reference counting overhead of LOAD_FAST variants #130704

New issue
Copy link
New issue
Copy link
Closed
Closed
Optimize reference counting overhead of LOAD_FAST variants#130704
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement

Description

@mpage
mpage
opened on Feb 28, 2025
Issue body actions

Feature or enhancement

Proposal:

LOAD_FAST and its super instruction form are the most frequently executed bytecode instructions in most Python programs (they represent ~20% of dynamic instruction frequency on the benchmark suite). While they are very cheap (they're just an incref and a push to the stack), they are not free. If we can prove that the reference in the frame outlives the reference that is loaded on the stack we can use a cheaper variant of LOAD_FAST that loads an appropriately tagged borrowed reference onto the operand stack, thereby avoiding the incref/decref.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

faster-cpython/ideas#700

Linked PRs

  • gh-130704: Strength reduce LOAD_FAST{_LOAD_FAST} #130708
Reacted by Ken Jin

Activity

  1. mpage
    added
    type-featureA feature request or enhancementA feature request or enhancement
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Feb 28, 2025
  2. picnixz
    added
    performancePerformance or resource usagePerformance or resource usage
    on Feb 28, 2025
  3. mpage
    added a commit that references this issue on Apr 1, 2025

    gh-130704: Strength reduce `LOAD_FAST{_LOAD_FAST}` (#130708)

    053c285
  4. mpage
    closed this as completedon Apr 1, 2025
  5. colesbury
    added 2 commits that reference this issue on Apr 29, 2025

    pythongh-133164: Add `PyUnstable_Object_IsUniqueTemporary` C API

    32b6cd0

    gh-133164: Add `PyUnstable_Object_IsUniqueReferencedTemporary` C API (g…

    f237953
  6. Pranjal095
    added a commit that references this issue on Jul 12, 2025

    pythongh-133164: Add `PyUnstable_Object_IsUniqueReferencedTemporary` …

    ba5b945
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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement

    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.