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.

Source Distribution

cuid-0.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

cuid-0.2-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cuid-0.2.tar.gz.

File metadata

  • Download URL: cuid-0.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cuid-0.2.tar.gz
Algorithm Hash digest
SHA256 148849bdf46fb7494fb4998e1852be231edbfe2c74d642d4a24a52e2742613dc
MD5 1bf6be71294c0be1440b3898973b9eef
BLAKE2b-256 e411384bac4e7c8d6cf9a6995e5721d4859b40120f16ae6a5c7c0623138f8b92

See more details on using hashes here.

File details

Details for the file cuid-0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cuid-0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 235e1eaa2f939b4cea1da36e9993de13ecc302eb034b5cea532c75530f682e9a
MD5 be62444b5a340fa351a141781eacaa91
BLAKE2b-256 3e3d57a6aecdb407d073429254b015d2e2a24ef2a1ae49813b191e7ca0a8d364

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page