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 — bpo-46921: Vectorcall support for `super()` by Fidget-Spinner · Pull Request #31687 · python/cpython

Conversation

@Fidget-Spinner

@Fidget-Spinner Fidget-Spinner commented Mar 4, 2022 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Benchmarks todo.

https://bugs.python.org/issue46921

Sorry, something went wrong.

Uh oh!

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

All reactions
@Fidget-Spinner
vectorcall support for super()
a88ec4c
@Fidget-Spinner
Fidget-Spinner requested a review from markshannon as a code owner March 4, 2022 16:44
@bedevere-bot bedevere-bot added the awaiting core review label Mar 4, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Mar 4, 2022
corona10
corona10 reviewed Mar 4, 2022
View reviewed changes
Comment thread Objects/typeobject.c Resolved

Uh oh!

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

@Fidget-Spinner @corona10
Use _PyArg_NoKwnames instead
896eb36
Co-Authored-By: Dong-hee Na <[email protected]>
corona10
corona10 reviewed Mar 5, 2022
View reviewed changes
Comment thread Objects/typeobject.c Resolved

Uh oh!

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

corona10
corona10 requested changes Mar 5, 2022
View reviewed changes

@corona10 corona10 left a comment •
edited
Loading

Uh oh!

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

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.

The current PR does not check the number of arguments.
Please add the unit test for this also :)

AS-IS

>>> super(int, int, int)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: super() takes at most 2 arguments (3 given)

PR

>>> super(int, int, int)
<super: <class 'int'>, NULL>

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Objects/typeobject.c Resolved

Uh oh!

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

@bedevere-bot bedevere-bot removed the awaiting core review label Mar 5, 2022
@bedevere-bot

bedevere-bot commented Mar 5, 2022

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.

@bedevere-bot bedevere-bot added the awaiting changes label Mar 5, 2022
@corona10

corona10 commented Mar 5, 2022

Copy link
Copy Markdown
Member

See my benchmark: https://bugs.python.org/msg414577
It looks like worth applying the vector call :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@Fidget-Spinner @corona10
Address code review
0bbe8d6
Co-Authored-By: Dong-hee Na <[email protected]>
@Fidget-Spinner

Fidget-Spinner commented Mar 5, 2022

Copy link
Copy Markdown
Member Author

@corona10 thanks for taking the time to benchmark this and for the extremely useful suggestions too. I forgot all the cool argument checking helpers we have since I'm a little rusty.

If you're interested, there's the monster GH-30992 too where I measured >2X speedup. But it's very complex and I don't have high hopes for it being merged.

corona10 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.

@sweeneyde

sweeneyde commented Mar 5, 2022

Copy link
Copy Markdown
Member

I wonder how much a free list would help? I'd bet super objects typically have short lifetimes and not many are alive at once.

All reactions

Sorry, something went wrong.

Uh oh!

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

@corona10

corona10 commented Mar 5, 2022

Copy link
Copy Markdown
Member

@Fidget-Spinner

Please add the unit test for this also :)

As I wrote, please add the test for checking TypeError when the given number of arguments are greater equal than 3 :)

Fidget-Spinner 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.

@Fidget-Spinner
Add a tests
4416fe6
@Fidget-Spinner

Fidget-Spinner commented Mar 5, 2022

Copy link
Copy Markdown
Member Author

@Fidget-Spinner

Please add the unit test for this also :)

As I wrote, please add the test for checking TypeError when the given number of arguments are greater equal than 3 :)

🤦 my bad, I missed that. Thanks again.

I added one more test since I noticed it wasn't covered in the test suite.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Fidget-Spinner

Fidget-Spinner commented Mar 5, 2022

Copy link
Copy Markdown
Member Author

I wonder how much a free list would help? I'd bet super objects typically have short lifetimes and not many are alive at once.

There will probably be some improvement versus relying on CPython's obmalloc "free list". My final goal is to not need any super object at all though :). BTW, are you able to guesstimate how much more complexity we need for a super free list? If it isn't too complex, it's likely more worth it than my cached superinstruction overkill implementation.

All reactions

Sorry, something went wrong.

Uh oh!

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

@sweeneyde

sweeneyde commented Mar 5, 2022

Copy link
Copy Markdown
Member

I wonder how much a free list would help? I'd bet super objects typically have short lifetimes and not many are alive at once.

There will probably be some improvement versus relying on CPython's obmalloc "free list". My final goal is to not need any super object at all though :). BTW, are you able to guesstimate how much more complexity we need for a super free list? If it isn't too complex, it's likely more worth it than my cached superinstruction overkill implementation.

I think it's (relatively) straightforward, see floatobject.c for an example. The actual free list gets attached to _PyInterpreterState there.

All reactions

Sorry, something went wrong.

Uh oh!

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

corona10
corona10 approved these changes Mar 6, 2022
View reviewed changes

@corona10 corona10 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.

LGTM
Feel free to merge this PR :)

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting changes labels Mar 6, 2022
@Fidget-Spinner
Fidget-Spinner merged commit 602024e into python:main Mar 6, 2022
@bedevere-bot bedevere-bot removed the awaiting merge label Mar 6, 2022
@Fidget-Spinner
Fidget-Spinner deleted the super_vectorcall branch March 6, 2022 06:21
@Fidget-Spinner

Fidget-Spinner commented Mar 6, 2022

Copy link
Copy Markdown
Member Author

@corona10 thanks for the reviews!

All reactions

Sorry, something went wrong.

Uh oh!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@corona10 corona10 corona10 approved these changes
@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.

5 participants

@Fidget-Spinner @bedevere-bot @corona10 @sweeneyde @the-knights-who-say-ni
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.