.. _rewritten in C: https://bugs.python.org/issue16991
=============
cyordereddict
=============
.. image:: https://travis-ci.org/shoyer/cyordereddict.svg?branch=master
:target: https://travis-ci.org/shoyer/cyordereddict
.. image:: https://badge.fury.io/py/cyordereddict.svg
:target: https://pypi.python.org/pypi/cyordereddict
The Python standard library's ``OrderedDict`` ported to Cython. A drop-in
replacement that is 2-6x faster.
Install:
``pip install cyordereddict``
Dependencies:
CPython (2.6, 2.7, 3.3 or 3.4) and a C compiler. Cython is only required
for the dev version.
Use:
.. code-block:: python
from cyordereddict import OrderedDict
Benchmarks:
Python 2.7:
================== ================================= =========================
Test Code Ratio (stdlib / cython)
================== ================================= =========================
``__init__`` empty ``OrderedDict()`` 1.8
``__init__`` list ``OrderedDict(list_data)`` 4.8
``__init__`` dict ``OrderedDict(dict_data)`` 4.6
``__setitem__`` ``ordereddict[0] = 0`` 8.6
``__getitem__`` ``ordereddict[0]`` 3
``update`` ``ordereddict.update(dict_data)`` 5.5
``__iter__`` ``list(ordereddict)`` 5.6
``items`` ``ordereddict.items()`` 5.9
``__contains__`` ``0 in ordereddict`` 2.3
================== ================================= =========================
Python 3.4:
================== ================================= =========================
Test Code Ratio (stdlib / cython)
================== ================================= =========================
``__init__`` empty ``OrderedDict()`` 1.5
``__init__`` list ``OrderedDict(list_data)`` 3.9
``__init__`` dict ``OrderedDict(dict_data)`` 4.2
``__setitem__`` ``ordereddict[0] = 0`` 8.4
``__getitem__`` ``ordereddict[0]`` 2.9
``update`` ``ordereddict.update(dict_data)`` 6.5
``__iter__`` ``list(ordereddict)`` 2.3
``items`` ``list(ordereddict.items())`` 2.1
``__contains__`` ``0 in ordereddict`` 2.3
================== ================================= =========================
To run these yourself, use ``cyordereddict.benchmark()``
Cavaets:
``cyorderedddict.OrderedDict`` is an extension type (similar to the
built-in ``dict``) instead of a Python class. This is necessary for speed,
but means that in a few pathological cases its behavior will differ from
``collections.OrderedDict``:
* The ``inspect`` module does not work on ``cyorderedddict.OrderedDict``
methods.
* Extension types use slots instead of dictionaries, so you cannot add
custom attributes without making a subclass (e.g.,
``OrderedDict.foo = 'bar'`` will fail).
You can do anything else you might do with an OrderedDict, including
subclassing: everything else passes the ``collections.OrderedDict`` test
suite. We based the Cython code directly on the Python standard library,
and thus use separate code bases for Python 2 and 3, specifically to
reduce the potential for introducing new bugs or performance regressions.
License:
MIT. Based on the Python standard library, which is under the Python
Software Foundation License.
Metadata
Release files for cyordereddict 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cyordereddict-1.0.0.tar.gz | 138.2 kB | Without provenance | Details for cyordereddict-1.0.0.tar.gz |
Release files / cyordereddict-1.0.0.tar.gz
| Download URL | cyordereddict-1.0.0.tar.gz |
|---|---|
| Size | 138.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9b2c31796999770801a9a49403b8cb49510ecb64e5d1e9d4763ed44f2d5a76e
|
|
BLAKE2b-256 checksum How to use checksums |
d11a364cbfd927be1b743c7f0a985a7f1f7e8a51469619f9fefe4ee9240ba210
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for cyordereddict 1.0.0
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.