[Numpy-discussion] Array pooling
Charles R Harris
charlesr.harris at gmail.com
Wed Aug 23 09:39:44 CDT 2006
Hi Carlos,
On 8/22/06, Carlos Pita <carlosjosepita at yahoo.com.ar> wrote:
>
> One reason is to use operator syntax: buf1 = buf2 + buf3, instead of
> add(buf2,buf3, buf1). The other is to spare the final user (synth
> programmer) any buffer bookkeeping.
>
I see.
My idea was to keep track of pooled buffers' reference counts, so that those
> currently unused would have a refcount of 1 and could be safely deleted
> (well, if pool policy variables allow it). But as buffers are acquired all
> the time, even a simple (pure-python) pooling policy implementation is
> pretty time consuming. In fact, I have benchmarked this against simply
> creating new zeros-arrays every time, and the non-pooling version just runs
> faster. That was when I thought that numpy could be doing some internal
> pooling by itself.
>
I think the language libraries themselves must do some sort of pooling, at
least the linux ones seem to. C++ programs do a lot of creation/destruction
of structures on the heap and I have found the overhead noticeable but
surprisingly small. Numpy arrays are a couple of layers of abstraction up,
so maybe not quite as fast.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060823/95ddb416/attachment-0001.html
More information about the Numpy-discussion
mailing list