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 float operations by mutating uniquely-referenced operands in place (JIT only) · Issue #146306 · python/cpython

Optimize float operations by mutating uniquely-referenced operands in place (JIT only) #146306

New issue
Copy link
New issue
Copy link
Closed
Closed
Optimize float operations by mutating uniquely-referenced operands in place (JIT only)#146306
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetopic-JITtype-featureA feature request or enhancementA feature request or enhancement

Description

@eendebakpt
eendebakpt
opened on Mar 22, 2026
Issue body actions

Feature or enhancement

Proposal:

When the tier 2 optimizer can prove that an operand to a float binary operation is uniquely referenced, we can mutate it in place instead of allocating a new PyFloatObject. This avoids a PyFloat_FromDouble allocation and the subsequent deallocation of the consumed operand on every iteration.

The unique reference tracking infrastructure added in #144300 can be used for the float operations as well. Also see #90530 where a similar optimization was proposed for tier 1 using runtime refcount checks.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

  • gh-146306: Optimize float operations by mutating uniquely-referenced operands in place (JIT only) #146307
Reacted by Sergey Miryanov and Oxicid

Activity

  1. eendebakpt
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Mar 22, 2026
  2. eendebakpt
    added a commit that references this issue on Mar 22, 2026

    pythongh-146306: Optimize float arithmetic in JIT by mutating uniquel…

    42d12b7
  3. eendebakpt
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    topic-JIT
    performancePerformance or resource usagePerformance or resource usage
    on Mar 22, 2026
  4. Fidget-Spinner
    added a commit that references this issue on Mar 24, 2026

    gh-146306: JIT: Optimize float operations by mutating uniquely-refere…

    951675c
  5. Fidget-Spinner commented on Mar 24, 2026

    @Fidget-Spinner
    Fidget-Spinner
    on Mar 24, 2026
    Member
    More actions

    I think the remaining float operations are probably rare and also annoying to account for (e.g. float OP int), so let's consider this done, and expand on it in future issues if need be.

    The next big thing is probably compact longs.

    Reacted by stonebig
  6. Fidget-Spinner
    closed this as completedon Mar 24, 2026
  7. eendebakpt
    added 6 commits that reference this issue on Mar 24, 2026

    pythongh-146306: Specialize float/float true division in tier 2 optim…

    ff4e7bb

    pythongh-146306: Specialize float/float true division in tier 2 optim…

    193b808

    pythongh-146306: Specialize float/float true division in tier 2 optim…

    a1cba21

    pythongh-146306: Specialize float/float true division in tier 2 optim…

    c270286

    pythongh-146306: Specialize float/float true division in tier 2 optim…

    9e695b8

    pythongh-146306: Specialize float/float true division in tier 2 optim…

    c846269
  8. clin1234
    added a commit that references this issue on Apr 16, 2026

    pythongh-146306: JIT: Optimize float operations by mutating uniquely-…

    b6e8752
  9. ljfp
    added a commit that references this issue on Apr 25, 2026

    pythongh-146306: JIT: Optimize float operations by mutating uniquely-…

    c3dfd7c
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 usagetopic-JITtype-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.