• Victor Stinner's avatar
    Optimize slots: avoid temporary PyMethodObject · 516b9816
    Victor Stinner yazdı
    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: 's avatarINADA Naoki <songofacandy@gmail.com>
    516b9816
Adı
Son kayıt (commit)
Son güncelleme
.github Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Programs Loading commit data...
Python Loading commit data...
Tools Loading commit data...
.bzrignore Loading commit data...
.gitignore Loading commit data...
.hgeol Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
.hgtouch Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README Loading commit data...
aclocal.m4 Loading commit data...
config.guess Loading commit data...
config.sub Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...