[Numpy-discussion] Double-ended queues
Tue Sep 25 11:03:18 CDT 2012
On Tue, Sep 25, 2012 at 4:31 AM, Sturla Molden <firstname.lastname@example.org> wrote:
> Also, instead of writing a linked list, consider collections.deque.
> A deque is by definition a double-ended queue. It is just waste of time
> to implement a deque (double-ended queue) and hope it will perform
> better than Python's standard lib collections.deque object.
not for insertion, deletion, etc, but there _may_ be a benefit to a
class that stores the data in a homogenous data data buffer compatible
- you could use non-standard data types (uint, etc...)
- It would be more memory efficient *not having to store all those
python objects for each value)
- you could round-trip to/from numpy arrays without data copying (or
with efficient data copying...) for other operations.
Whether it's worth the work would depend on teh use case, of course.
Writing such a thing in Cython would be pretty easy though,
particularly if you only needed to support a couple types.
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
More information about the NumPy-Discussion