Skip to main content

Fast, scalable unique ID generation

Project description

# cuid.py [![Build Status](https://travis-ci.org/necaris/cuid.py.svg)](https://travis-ci.org/necaris/cuid.py)

Implementation of https://github.com/ericelliott/cuid in Python.

A `cuid` is a portable and sequentially-ordered unique identifier designed for
horizontal scalability and speed -- this version is ported from the reference
implementation in Javascript.

Tested on CPython 2.7-3.6 as well as PyPy & PyPy3 -- see Travis-CI link above.

Rough benchmarks on my machine (mid-2014 Macbook Pro, 2.8GHz i7) using `setup.py
bench` (which times the creation of 1 million cuids):

Version | μs / cuid
--------|----------
CPython 3.6 | 11.368
CPython 3.5 | 9.834
CPython 3.4 | 9.665
CPython 2.7 | 8.869
PyPy 5.6.0 | 0.508

_(Note that timing the creation of fewer IDs changes the way PyPy runs the code, because of JIT warmup --
obviously creating this many IDs takes advantage of the warmed JIT)_

*Note*: For now, this has no dependencies outside the standard library -- in
time this may change, to provide better random numbers and / or performance.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cuid, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size cuid-0.3.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page