Fast, scalable unique ID generation
Implementation of https://github.com/ericelliott/cuid in Python.
cuid is a portable and sequentially-ordered unique identifier designed for
horizontal scalability and speed -- this version is ported from the reference
NOTE: Particularly if you have security concerns, the
cuid standard has been deprecated in favor of
Tested on CPython 2.7, 3.6-3.11 as well as PyPy & PyPy3.
Rough benchmarks on my machine (i7-8750H CPU @ 2.20GHz) using
(which times the creation of 1 million
|Version||ns / cuid|
|PyPy 7.1.1 (Python 2.7.13)||326.344|
|PyPy3 7.1.1 (Python 3.6.1)||562.673|
(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)
For now, this has no dependencies outside the standard library -- in time this may change, to provide better random numbers and / or performance.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.