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 — GH-130415: Optimize constant comparison in JIT builds by savannahostrowski · Pull Request #131489 · python/cpython

Conversation

@savannahostrowski

@savannahostrowski savannahostrowski commented Mar 20, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Better constant narrowing in the JIT optimizer #130415

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
savannahostrowski added 7 commits March 17, 2025 21:13
@savannahostrowski
Pop two load const inline borrow
2a92ba9
@savannahostrowski
Compute result and use rich compare
fee3937
@savannahostrowski
Merge main
90fdaf8
@savannahostrowski
Remove deepfreeze
1a47c8d
@savannahostrowski
add test for optimization
697323b
@savannahostrowski
fix assert
6c98c24
@savannahostrowski
remove extra newline
5cf0e16
@savannahostrowski
savannahostrowski requested a review from brandtbucher March 20, 2025 03:42
@savannahostrowski
savannahostrowski requested review from Fidget-Spinner and markshannon as code owners March 20, 2025 03:42
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 20, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Mar 20, 2025
Better constant narrowing in the JIT optimizer #130415
Closed
13 of 17 tasks
@blurb-it
📜🤖 Added by blurb_it.
69d14ef
@savannahostrowski savannahostrowski changed the title GH-130415: Optimize constant comparison GH-130415: Optimize constant comparison in JIT builds Mar 20, 2025
brandtbucher
brandtbucher requested changes Mar 20, 2025
View reviewed changes

@brandtbucher brandtbucher left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks, this new instruction opens a lot of doors for us in the optimizer! A few things I noticed:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_capi/test_opt.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/optimizer_bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting core review labels Mar 20, 2025
@bedevere-app

bedevere-app Bot commented Mar 20, 2025

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher

brandtbucher commented Mar 20, 2025

Copy link
Copy Markdown
Member

JIT test failure looks unrelated, and due to GH-131488.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@savannahostrowski @brandtbucher
Apply suggestions from code review
e40e580
Co-authored-by: Brandt Bucher <[email protected]>
brandtbucher
brandtbucher requested changes Mar 20, 2025
View reviewed changes

@brandtbucher brandtbucher left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Just a couple more things. Also, can you merge in main? I think JIT CI should be fixed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_capi/test_opt.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/optimizer_bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski added 2 commits March 20, 2025 19:43
@savannahostrowski
Fix indentation, remove extra check
7621359
@savannahostrowski
Merge branch 'main' into pop_2
ebf9119
brandtbucher
brandtbucher approved these changes Mar 21, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting changes labels Mar 21, 2025
@brandtbucher

brandtbucher commented Mar 21, 2025

Copy link
Copy Markdown
Member

Tail-calling failure is unrelated, and showing up on other PRs too.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher
brandtbucher merged commit b92ee14 into python:main Mar 21, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Mar 21, 2025
@brandtbucher

brandtbucher commented Mar 21, 2025

Copy link
Copy Markdown
Member

So next steps would be doing the same thing for the other COMPARE_OP specializations (COMPARE_OP_FLOAT and COMPARE_OP_STR). Also for a bunch of BINARY_OP specializations like _BINARY_OP_ADD_INT, etc. (these are easier, since many of them already evaluate the constant... we just need to check to see if it's immortal).

Is this something you'd be interested in doing?

savannahostrowski reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brianschubert brianschubert mentioned this pull request Mar 21, 2025
Fix indentation in optimizer test #131569
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brandtbucher brandtbucher brandtbucher approved these changes
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner Fidget-Spinner is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@savannahostrowski @brandtbucher
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.