[Numpy-discussion] Double-ended queues
Chris Barker
chris.barker@noaa....
Tue Sep 25 11:03:18 CDT 2012
On Tue, Sep 25, 2012 at 4:31 AM, Sturla Molden <sturla@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
with numpy:
- 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.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
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@noaa.gov
More information about the NumPy-Discussion
mailing list