[Cython] inline defnode calls

Stefan Behnel stefan_ml at behnel.de
Wed Jan 25 13:10:02 CET 2012

mark florisson, 25.01.2012 12:36:
> On 25 January 2012 11:32, mark florisson wrote:
>> On 25 January 2012 11:24, Vitja Makarov <vitja.makarov at gmail.com> wrote:
>>> I'm thinking about implementing  "conditional inlining": depending on
>>> what function actually is it'll make direct call to C function or
>>> PyObject_Call().
>> Sounds like a good idea. Any idea how much faster that can be?
> Hm, probably about an order of magnitude for a noop function (simple
> test of cdef vs def call).

Easily, yes. It avoids all the argument type conversion and
packing/unpacking. That's a huge overhead compared to a straight
conditional C function call which the C compiler could even inline, or the
CPU could at least keep in its branch prediction cache and optimise its
pipeline for.


More information about the cython-devel mailing list