2008/5/5 Robert Kern <[EMAIL PROTECTED]>:
> On Mon, May 5, 2008 at 7:44 AM, David Cournapeau
>  <[EMAIL PROTECTED]> wrote:
>
> >  In numpy, we can always replace realloc by malloc/free, because we know
>  >  the size of the old block: would deprecating PyMemData_RENEW and
>  >  replacing them by PyMemeData_NEW/PyMemData_FREE be possible, such as to
>  >  make all numpy arrays follow a default alignement ? There are only a few
>  >  of them in numpy (6 of them), 0 in scipy, and I guess extensions never
>  >  really used them ?
>
>  I am in favor of at least trying this out. We will have to have a set
>  of benchmarks to make sure we haven't hurt the current uses of
>  PyMemData_RENEW which Tim points out.

realloc() may not be a performance win anyway. Allocating new memory
is quite fast, copying data is quite fast, and in-place realloc()
tends to cause memory fragmentation - take an arena full of 1024-byte
blocks and suddenly make one of them 256 bytes long and you haven't
gained anything at all in most malloc() implementations. So yes,
benchmarks.

Anne
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to