[Numpy-discussion] Managing Rolling Data

Sturla Molden sturla@molden...
Thu Feb 22 06:29:46 CST 2007


On 2/21/2007 11:03 PM, Anne Archibald wrote:

> I think it is almost as efficient as memmove; in particular, it
> doesn't create any temporaries 

A ring buffer is O(1) whereas a memmove is O(N). Unless the amount of 
data to be moved are very small, this makes the ringbuffer the more 
attractive solution.

Slicing becomes a little bit more complicated with a ring, but not very 
much. The data are stored in two ordered and contiguous segments: after 
and before the stack pointer (in that order).


Sturla Molden


More information about the Numpy-discussion mailing list