[Cython] CEP1000: Native dispatch through callables

Stefan Behnel stefan_ml at behnel.de
Sun Apr 15 08:26:12 CEST 2012


mark florisson, 14.04.2012 23:15:
> On 14 April 2012 22:02, Stefan Behnel wrote:
>> Dag Sverre Seljebotn, 14.04.2012 21:08:
>>>  * TBD: Support for Cython-specific constructs like memoryview slices
>>>    (so that arrays with strides and shape can be passed faster than
>>>    passing an {{{"O"}}}).
>>
>> Is this really Cython specific or would a generic Py_buffer struct work?
> 
> That could work through simple unboxing wrapper functions, but it
> would add some overhead, specifically because it would have to check
> the buffer's object, and if it didn't exist or was not a memoryview
> object, it would have to create one (checking whether something is a
> memoryview object would also be a pain, as each module has a different
> memoryview type). That could still be feasible for interaction with
> Cython functions from non-Cython code.

Hmm, I don't get it. Isn't the overhead always there when a memory view is
requested in the signature? You'd have to create one for each call and that
seriously hurts the efficiency. Is that a common use case? Why would you
want to do more than passing unboxed buffers?

Stefan


More information about the cython-devel mailing list