Cython implementation of Python's collections.OrderedDict
Project description
A drop-in replacement for the standard library’s OrderedDict that is 2-3x faster. Currently only for Python 2.7.
- Benchmarks:
Test
Code
Ratio (stdlib / cython)
__init__ empty
OrderedDict()
1.7
__init__ list
OrderedDict(list_data)
3.2
__init__ dict
OrderedDict(dict_data)
3.1
__setitem__
ordereddict[-1] = False
2.9
__getitem__
ordereddict[100]
2.4
update
ordereddict.update(dict_data)
2.9
__iter__
list(ordereddict)
5.7
__contains__
100 in ordereddict
1.8
Numbers larger than 1 mean cyorderedict is faster. To run yourself, use cyordereddict.benchmark().
- Install:
pip install cyordereddict
- Dependencies:
cyorderedict is written with Cython, but requires no dependecies other than CPython and a C compiler.
- Use:
try: from cyordereddict import OrderedDict except ImportError: from collections import OrderedDict
- License:
MIT. cyordereddict is largely adapted from the Python standard library, which is available under the Python Software Foundation License.
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
File details
Details for the file cyordereddict-0.1.1.tar.gz
.
File metadata
- Download URL: cyordereddict-0.1.1.tar.gz
- Upload date:
- Size: 49.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74d6304ab323fc87b513e1752e373cb6ce3c2471948a32d6139f4b5aef0c7705 |
|
MD5 | fcc5f079a766af58e30c6db3f2eb04a3 |
|
BLAKE2b-256 | fd7e3baf782292bf76e736fd78917afd560ee6cb83aa7dd25e785a6e24d7ce2c |