Skip to content

gh-100165: Add BINARY_OP_AND_INT for integer & operation. #100166

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

Closed
wants to merge 4 commits into from

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Dec 11, 2022

According to stats, BINARY_AND_INT will cover 50.7% of failures.

@netlify
Copy link

netlify bot commented Dec 11, 2022

Deploy Preview for python-cpython-preview canceled.

Name Link
🔨 Latest commit bc11c05
🔍 Latest deploy log https://app.netlify.com/sites/python-cpython-preview/deploys/6396bb1824f6370008b6aceb

@corona10 corona10 changed the title gh-100165: Add BINARY_OP_AND_INT for integer & operation. [WIP] gh-100165: Add BINARY_OP_AND_INT for integer & operation. Dec 11, 2022
@corona10 corona10 changed the title [WIP] gh-100165: Add BINARY_OP_AND_INT for integer & operation. gh-100165: Add BINARY_OP_AND_INT for integer & operation. Dec 11, 2022
@corona10
Copy link
Member Author

corona10 commented Dec 11, 2022

Stats

Copy link
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks Dong-hee.

…e-100165.GE1Iui.rst

Co-authored-by: Ken Jin <kenjin@python.org>
@Fidget-Spinner
Copy link
Member

Let's wait for Mark before merging this.

@brandtbucher
Copy link
Member

Does this improve the pyperformance results at all? If not, I'd suggest that we take a different approach (discussed with @markshannon this morning):

Rather than try to add more and more non-performance-improving BINARY_OP specializations to get stats up (with diminishing returns), one idea I'm starting to work on this week is a single specialization that covers, for example, all remaining operations between int or float operands, by pre-populating a table of function pointers that handle each lhs_type x rhs_type x op combination, and having a single specialization that handles all of those by dispatching from the table.

Once we get that working, the mechanism could be extended to cache the results of recent operator lookups (like the method cache) or even allow extensions like NumPy to register custom specializations.

I'd be happy to run the pyperformance numbers for you if you want. I also have a small hunch that the pyperformance suite over-represents how often integer & actually occurs in real code (similar to how it over-represents subscripting array.array).

@brandtbucher
Copy link
Member

Also, see our previous rejection of this idea: #94109.

@corona10
Copy link
Member Author

Rather than try to add more and more non-performance-improving BINARY_OP specializations to get stats up (with diminishing returns)

Ah, I agree that what we have to go.

I'd be happy to run the pyperformance numbers for you if you want

Same result with Mark's last running: #94109 (comment)

Well, I agree that this PR is not worth to merge.

@corona10 corona10 closed this Dec 13, 2022
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.

4 participants