From: Charles R H. <cha...@gm...> - 2006-08-23 14:39:55
|
Hi Carlos, On 8/22/06, Carlos Pita <car...@ya...> 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 |