mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Issue #29507: Optimize slots calling Python methods. For Python methods, get the unbound Python function and prepend arguments with self, rather than calling the descriptor which creates a temporary PyMethodObject. Add a new _PyObject_FastCall_Prepend() function used to call the unbound Python method with self. It avoids the creation of a temporary tuple to pass positional arguments. Avoiding temporary PyMethodObject and avoiding temporary tuple makes Python slots up to 1.46x faster. Microbenchmark on a __getitem__() method implemented in Python: Median +- std dev: 121 ns +- 5 ns -> 82.8 ns +- 1.0 ns: 1.46x faster (-31%) Co-Authored-by: INADA Naoki <songofacandy@gmail.com> |
||
|---|---|---|
| .. | ||
| clinic | ||
| stringlib | ||
| abstract.c | ||
| accu.c | ||
| boolobject.c | ||
| bytearrayobject.c | ||
| bytes_methods.c | ||
| bytesobject.c | ||
| capsule.c | ||
| cellobject.c | ||
| classobject.c | ||
| codeobject.c | ||
| complexobject.c | ||
| descrobject.c | ||
| dict-common.h | ||
| dictnotes.txt | ||
| dictobject.c | ||
| enumobject.c | ||
| exceptions.c | ||
| fileobject.c | ||
| floatobject.c | ||
| frameobject.c | ||
| funcobject.c | ||
| genobject.c | ||
| iterobject.c | ||
| listobject.c | ||
| listsort.txt | ||
| lnotab_notes.txt | ||
| longobject.c | ||
| memoryobject.c | ||
| methodobject.c | ||
| moduleobject.c | ||
| namespaceobject.c | ||
| object.c | ||
| obmalloc.c | ||
| odictobject.c | ||
| rangeobject.c | ||
| README | ||
| setobject.c | ||
| sliceobject.c | ||
| structseq.c | ||
| tupleobject.c | ||
| typeobject.c | ||
| typeslots.inc | ||
| typeslots.py | ||
| unicodectype.c | ||
| unicodeobject.c | ||
| unicodetype_db.h | ||
| weakrefobject.c | ||
Source files for various builtin objects