Skip to main content

fastqueue

Tests PyPI versions PyPI license
PyPI

Single-ended fast queues built in C tuned for Python.

Installation

Install with uv:

uv pip install fastqueue-lib

Quickstart

For general use cases fastqueue.Queue() objects are tuned to perform well. The enqueue and dequeue methods perform well over a large sequence of arbitrary operations. fastqueue.Queue() supports many standard sequence methods similar to lists. fastqueue.Queue() minimizes memory usage but maintains the fast queue speeds.

>>> from fastqueue import Queue
>>> queue = Queue()
>>> queue.extend(['🚒', '🛴'])
>>> queue[0]
'🚒'
>>> '🛴' in queue
True
>>> queue.enqueue('🚅')
>>> queue.enqueue('🚗')
>>> queue[-1]
'🚗'
>>> [queue.dequeue() for _ in range(len(queue)) ]
['🚒', '🛴', '🚅', '🚗']

For more specialized cases fastqueue.QueueC() objects are tuned to perform well. The interface for fastqueue.QueueC() is identical to fastqueue.Queue(). The enqueue and dequeue methods perform similarly well over a large sequence of arbitrary operations. fastqueue.QueueC() handles memory differently by doubling the capacity when full. This increases the complexity but maintains fast amortized cost. The benefit of this approach is even faster __getitem__ and __setitem__ speeds

>>> from fastqueue import QueueC

>>> queue_c = QueueC()
>>> queue_c.extend(['🚒', '🛴'])
>>> queue_c[0]
'🚒'
>>> '🛴' in queue_c
True
>>> queue_c.enqueue('🚅')
>>> queue_c.enqueue('🚗')
>>> queue_c[-1]
'🚗'
>>> [queue_c.dequeue() for _ in range(len(queue_c)) ]
['🚒', '🛴', '🚅', '🚗']

Benchmarks

Run every benchmark and save all five figures as PNG and SVG, along with the measurements and build metadata in JSON:

uv pip install ".[benchmark]"

uv run python benchmark/main.py --profiles queue
uv run python benchmark/main.py --profiles iteration
windows wsl Indexed_Increment Iterator_Local_Increment Iterable_Instantiation

Metadata

Release files for fastqueue-lib 0.0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastqueue-lib 0.0.19
File Size Uploaded Provenance Actions
fastqueue_lib-0.0.19.tar.gz 21.1 kB Without provenance Details for fastqueue_lib-0.0.19.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fastqueue-lib 0.0.19
File Interpreter ABI Platform Actions
fastqueue_lib-0.0.19-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-64 Details for fastqueue_lib-0.0.19-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl

Total release size: 88.8 kB

Release files / fastqueue_lib-0.0.19.tar.gz

Download URL fastqueue_lib-0.0.19.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e17f4a1ff0b17b359c15e22b0086c85e98b98cd476581c4034cb17f5f4fb0d7f
BLAKE2b-256 checksum
How to use checksums
3d0e53566c68c961bbc6fa5ef906bfff87941e54858e74efc002b09ae849a2f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / fastqueue_lib-0.0.19-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl

Download URL fastqueue_lib-0.0.19-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Size 67.7 kB
Tags CPython 3.9 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
83fd1642b9e03f5724b8430874eafa25082de527ad8f35390f239b5087cdfee1
BLAKE2b-256 checksum
How to use checksums
ab3f0ca33b5dfd817e6e746461eb21863fb4296922a1c55b51639eacbbeb9e8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for fastqueue-lib 0.0.19

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page