INADA Naoki added the comment: This is proof of concept patch to support LOAD_METHOD & CALL_METHOD for METH_FASTCALL methods. (This patch should be applied after fastcall.patch)
$ ./python -m perf timeit --compare-to `pwd`/python-fastcall -s "d = b''" -- "d.decode()" python-fastcall: ..................... 91.0 ns +- 1.0 ns python: ..................... 80.3 ns +- 0.3 ns Median +- std dev: [python-fastcall] 91.0 ns +- 1.0 ns -> [python] 80.3 ns +- 0.3 ns: 1.13x faster $ ./python -m perf timeit --compare-to `pwd`/python-fastcall -s "d = b''" -- "d.decode('ascii')" python-fastcall: ..................... 116 ns +- 1 ns python: ..................... 106 ns +- 1 ns Median +- std dev: [python-fastcall] 116 ns +- 1 ns -> [python] 106 ns +- 1 ns: 1.10x faster Since PyCFunction is lighter than PyMethodObject, performance benefit seems smaller than Python method (up to 20%). Sadly speaking, there are only few METH_FASTCALL in builtin type. ---------- keywords: +patch Added file: http://bugs.python.org/file46286/loadmethod-fastcall.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29263> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com