[issue28754] Argument Clinic for bisect.bisect_left

Julien Palard report at bugs.python.org
Sat Nov 26 05:26:37 EST 2016


Julien Palard added the comment:

Hi Raymond,

> Curiously, this patch gives about a 10% to 15% speedup.  Any sense of how that improvement arises?

That's because Argument Clinic is generating methoddef with METH_FASTCALL:

$ grep FASTCALL Modules/clinic/_bisectmodule.c.h 
    {"bisect_right", (PyCFunction)bisect_bisect_right, METH_FASTCALL, bisect_bisect_right__doc__},
    {"insort_right", (PyCFunction)bisect_insort_right, METH_FASTCALL, bisect_insort_right__doc__},
    {"bisect_left", (PyCFunction)bisect_bisect_left, METH_FASTCALL, bisect_bisect_left__doc__},
    {"insort_left", (PyCFunction)bisect_insort_left, METH_FASTCALL, bisect_insort_left__doc__},

Instead of METH_VARARGS|METH_KEYWORDS:

-    {"bisect_right", (PyCFunction)bisect_right,
-        METH_VARARGS|METH_KEYWORDS, bisect_right_doc},
-    {"insort_right", (PyCFunction)insort_right,
-        METH_VARARGS|METH_KEYWORDS, insort_right_doc},
-    {"bisect_left", (PyCFunction)bisect_left,
-        METH_VARARGS|METH_KEYWORDS, bisect_left_doc},
-    {"insort_left", (PyCFunction)insort_left,
-        METH_VARARGS|METH_KEYWORDS, insort_left_doc},

----------

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


More information about the Python-bugs-list mailing list