like collections.deque, but different
Project description
deque-one
Work-in-progress drop-in replacement for Python's collection.deque
with O(1) item access and without sacrificing performance on other metrics.
Getting Started
The easiest way to get deque-one is to:
$ pip install deque-one
Alternatively, you can build it from source:
$ git clone https://github.com/styfenschaer/deque-one.git
$ cd deque-one
$ python setup.py install
The latter requires a C compiler compatible with your Python installation.
Once installed, it behaves like the built-in deque
but with O(1) instead of O(n) random item access:
import collections
import deque_one
col_deque = collections.deque(range(1_000_000))
one_deque = deque_one.deque(range(1_000_000))
%timeit col_deque[0]
%timeit one_deque[0]
# 33.6 ns ± 0.422 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)
# 33.3 ns ± 1.08 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)
%timeit col_deque[500_000]
%timeit one_deque[500_000]
# 89.3 µs ± 1.93 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
# 38.2 ns ± 1.45 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)
Implemented Methods
__init__
(only first argument)append
appendleft
pop
popleft
extend
extendleft
clear
__getitem__
__setitem__
__len__
__repr__
__str__
Implemented Properties
maxlen
(alwaysNone
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file deque-one-0.0.1.tar.gz
.
File metadata
- Download URL: deque-one-0.0.1.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c25c8b61893fe0942c4d4d60b4821ba9ec1539fe3daeee56492439a4b045b5c1 |
|
MD5 | d83cf4c9438bb8b312dfe0892e1c8cc7 |
|
BLAKE2b-256 | bf064d3058bd0ad0cc39309cbade74c3f89cb193da702b0b5d03f3216cc4f7f4 |
File details
Details for the file deque_one-0.0.1-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 15.9 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4644f363df04dcff3340a5c8f8277790752c2ded5d4bb5f8559ca789b7ae7758 |
|
MD5 | 88f6ff01e593d2f73b5b5a8ab4f8b09d |
|
BLAKE2b-256 | 5402bbc539fecb796c9387b79b99c5e61341b5fcb83a3ef9bcf04f2902675cbe |
File details
Details for the file deque_one-0.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 37.1 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bd346e0f4d2eafcc4c6fdc42a19646d4fec00e2c9204cc985fb34e9322e3c7a |
|
MD5 | 8b4922f8a75f6e82313b3ea8e69f0218 |
|
BLAKE2b-256 | 9287cac76f2bf47501e94ec8bf3e59a8f4f26b8ec081577fee6dbb7b751b208c |
File details
Details for the file deque_one-0.0.1-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.0 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccd13677c4d5c889bd33bf1cf1823671ddf66ed7e809d1f860e9791f68ca86a5 |
|
MD5 | 4ef2b67264becfcc4b896076fb729b30 |
|
BLAKE2b-256 | 342716071bb8de0ca6ac99088fe1d985d49f2bbd73829f0217f163903c26e836 |
File details
Details for the file deque_one-0.0.1-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 12.8 kB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8809f58c3a75ebbe2a0a349ba1621fef04fb7e0df8c8f1648aaff98cafdc3841 |
|
MD5 | c1664e03efbeab27d1598c3900f8ed4a |
|
BLAKE2b-256 | 1a4318a3b56278abda5a9e91f911a91a7d6c69f7c7aa14f398b1692a5985de0b |
File details
Details for the file deque_one-0.0.1-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 15.9 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d8d7ad0b9b4cb29b455a92b73d43f5f0f578497c3a17c23e0c68e65dec6bfb1 |
|
MD5 | 8e5b75fd0d6662bf795498db7dca514b |
|
BLAKE2b-256 | cc60c28d09e973d9b32158b4dd779e2d44cdeaae20150ac849534b7161f20619 |
File details
Details for the file deque_one-0.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 36.3 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0aef2de8e5c69d2f6f473797a752631f9a144d0341cce2cc883a969fa66a284c |
|
MD5 | 274696603fccb1229d30411328122e2c |
|
BLAKE2b-256 | ecd91bfa1dcfe0d1339bf7993c60cb936d976600c71ebab700666c8677758a7c |
File details
Details for the file deque_one-0.0.1-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 12.9 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52f215958ca8c3e31385ae664b50fa09e147aa4385c18a587b265fc31d8649cb |
|
MD5 | 9ea55fc09f062fbba8d1e75f6bea918a |
|
BLAKE2b-256 | 442e4e7cfaa0c2bcb8122df0651180cfc3c2fe7af75d9fb2d03d3b9e139f9728 |
File details
Details for the file deque_one-0.0.1-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 12.7 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 074b59dfc79a474270869cdcb6d4b4a2317b0d750ec1950e1928215c850e02d7 |
|
MD5 | 02db4707b93eea8081c6a59a1aa0e510 |
|
BLAKE2b-256 | f125f6da2971877b25385c7591ef1b4ed8b4e018cc6d93a824e96d7957a08ce5 |
File details
Details for the file deque_one-0.0.1-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 15.9 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 848914869c36154e30a5915a2224936025404f0ac37bcede974642d7e548a89c |
|
MD5 | 9b44da165d0078524fa730dab7cfd704 |
|
BLAKE2b-256 | 428b159d9a34086b2d7afe1d65dc743e761ec88c096445b56e0171df8f314508 |
File details
Details for the file deque_one-0.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 34.7 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f657f26435b77c756aa6835f408a00b61432832f12bbf2dd1b74b56eb7cda9a |
|
MD5 | 49fa9b0c55006a18df86402ba45fcb1c |
|
BLAKE2b-256 | 90a2fe7f6d9b5a866bfba449888cf09f6aa06eb21ff027cbdc1783ed68f4ee29 |
File details
Details for the file deque_one-0.0.1-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 12.9 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb00a93b6368e608de2cef2a386fb8be3ee8b271e760a989edaabc702eb57384 |
|
MD5 | 74318c4ab49dff8f756404787ce11803 |
|
BLAKE2b-256 | d71260708a6a094f39af8a3762cbc7e790dbf143b0042833a83e68fa20f19c6e |
File details
Details for the file deque_one-0.0.1-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: deque_one-0.0.1-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 12.7 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74185316d248f079cf5a25067be2167ca9620be06f3fe6f235edb69fd958ee26 |
|
MD5 | 67ae079db038367e862d13de53d9c9f1 |
|
BLAKE2b-256 | c97abd7821a19a1158e781fa2232f27fbd68467a549201b1091dd9f90766e8f6 |