[issue28243] Performance regression in functools.partial()

STINNER Victor report at bugs.python.org
Wed Sep 21 15:50:34 EDT 2016


STINNER Victor added the comment:

Oh, functools.partial.__call__() doesn't use fastcall yet. So compared to Python 3.5, fastcall shouldn't explain a major performance difference. FYI I'm working on an extension of fastcall to also support fastcall calling convention for obj.__call__() ;-)

But maybe the regression is related to code moved in ceval.c to support fastcall. I noticed differences with fastcall when you don't compile Python with LTO+PGO.

--

About the bytecode, "g(2)" in Python 3.6b1 is:

              0 LOAD_GLOBAL              0 (g)
              2 LOAD_CONST               1 (2)
              4 CALL_FUNCTION            1
              6 POP_TOP

In Python 3.5 the bytecode is similar, but the bytecode size is variable and CALL_FUNCTION is made of two parts: number of positional arguments and number of keyword arguments.

              0 LOAD_GLOBAL              0 (g)
              3 LOAD_CONST               1 (2)
              6 CALL_FUNCTION            1 (1 positional, 0 keyword pair)
              9 POP_TOP

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28243>
_______________________________________


More information about the Python-bugs-list mailing list