Add vectorcall for generic alias object #91223
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee = None closed_at = None created_at = <Date 2022-03-19.15:31:34.611> labels = ['library', '3.11'] title = 'Add vectorcall for generic alias object' updated_at = <Date 2022-03-21.21:15:20.006> user = 'https://github.com/penguin-wwy'
activity = <Date 2022-03-21.21:15:20.006> actor = 'gvanrossum' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = <Date 2022-03-19.15:31:34.611> creator = 'penguin_wwy' dependencies =  files =  hgrepos =  issue_num = 47067 keywords = ['patch'] message_count = 8.0 messages = ['415556', '415589', '415613', '415615', '415616', '415630', '415656', '415699'] nosy_count = 6.0 nosy_names = ['gvanrossum', 'JelleZijlstra', 'corona10', 'Dennis Sweeney', 'kj', 'penguin_wwy'] pr_nums = ['31996'] priority = 'normal' resolution = None stage = 'patch review' status = 'open' superseder = None type = None url = 'https://bugs.python.org/issue47067' versions = ['Python 3.11']
The text was updated successfully, but these errors were encountered:
We can advance the
ga_vectorcall -> origin.vectorcall
ga_make_tp_call -> _PyObject_MakeTpCall(packed argument) -> origin.tp_call
This will have no effect on tp_call, which still only needs to be packed once, while vectorcall does not need packed/unpacked
The point of bpo-40369 issue seems to be to provide vectorcall to the
However, my idea is to add vectorcall to gaobject, like this:
The idea came from my desire to implement different subclasses of a type when implementing some kind of factory model：
In the case of high type-hint coverage, the
Speedup 20% in my wsl2
I profiled dict[str, int](a=1, b=2), and it looks like a decent chunk of time comes from PyUnicode_New as used by PyObject_SetAttrString.
You could also try replacing PyObject_SetAttrString with PyObject_SetAttr and adding "__orig_class__" to the global strings with Tools/scripts/generate_global_objects.py, probably for a later PR.
Already done via
Also, I found that