Uh oh!
There was an error while loading. Please reload this page.
bpo-46921: Vectorcall support for super() - #31687
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Co-Authored-By: Dong-hee Na <donghee.na@python.org>
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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>
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot
commented
Mar 5, 2022
When you're done making the requested changes, leave the comment: |
corona10
commented
Mar 5, 2022
See my benchmark: https://bugs.python.org/msg414577 |
Co-Authored-By: Dong-hee Na <donghee.na@python.org>
Fidget-Spinner
commented
Mar 5, 2022
@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. |
sweeneyde
commented
Mar 5, 2022
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. |
corona10
commented
Mar 5, 2022
As I wrote, please add the test for checking TypeError when the given number of arguments are greater equal than 3 :) |
Fidget-Spinner
commented
Mar 5, 2022
🤦 my bad, I missed that. Thanks again. I added one more test since I noticed it wasn't covered in the test suite. |
Fidget-Spinner
commented
Mar 5, 2022
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. |
sweeneyde
commented
Mar 5, 2022
I think it's (relatively) straightforward, see floatobject.c for an example. The actual free list gets attached to _PyInterpreterState there. |
corona10
left a comment
There was a problem hiding this comment.
LGTM
Feel free to merge this PR :)
Fidget-Spinner
commented
Mar 6, 2022
@corona10 thanks for the reviews! |
Benchmarks todo.
https://bugs.python.org/issue46921