Wes McKinney wrote: > I am writing some Cython code and have noted that the buffer interface > offers very little speedup for PyObject arrays. In trying to rewrite the > same code using the C API in Cython, I find I can't get PyArray_SETITEM to > work, in a call like: > > PyArray_SETITEM(result, <void *> iterresult.dataptr, obj) > > where result is an ndarray of dtype object, and obj is a PyObject*.
Interesting. Whatever you end up doing, I'll make sure to integrate whatever works faster into Cython. I do doubt your results a bit though -- the buffer interface in Cython increfs/decrefs the objects, but otherwise it should be completely raw access, so using SETITEM shouldn't be faster except one INCREF/DECREF per object (i.e. still way faster than using Python). Could you perhaps post your Cython code? Dag Sverre _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion