Ticket #177 (new enhancement)
Efficient cdef calling convention for buffers
|Reported by:||dagss||Owned by:||somebody|
|Component:||Code Generation||Keywords:||numerics kurtgsoc|
Description (last modified by dagss) (diff)
Currently there's no way of creating efficient functions taking a buffer argument -- for starters cdef functions doesn't support declaring an argument as a buffer, and even if it did, it would mean a costly (in this context) buffer acquisition on every call.
An attractive alternative would be to have
cdef utilfunc(object[int] buf): ...
mean a different calling convention, where the caller must acquire the buffer, and a struct with the necesarry information is passed. If the caller already has a buffer then it can simply pass the information it already has.
(There's a subtlety here: If buf is reassigned to in utilfunc, then the original buffer must not be released, while the new buffer must be released eventually.)