[Numpy-discussion] Double-ended queues
chris.barker at noaa.gov
Tue Sep 25 12:03:18 EDT 2012
On Tue, Sep 25, 2012 at 4:31 AM, Sturla Molden <sturla at molden.no> 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
Chris.Barker at noaa.gov
More information about the NumPy-Discussion