Python UUID module written in C++
Project description
cpp_uuid is a Python library written in C++. It provides an API that, in most cases, covers usage of Python’s builtin UUID class. The library implements generate, convert to string and parse UUIDs version 4. It is also possible to convert UUIDs from uuid standard or compare between them.
In most cases you can just replace import section of your code.
from cpp_uuid import UUID, uuid4
item_uuid = uuid4()
other_uuid = UUID('c5fcf05c-6320-47ec-98c0-be84fdb1c321')
Module tested on Python versions from 3.8 to 3.12.
This library uses UUID4 generation from crashoz/uuid_v4 library.
Benchmarks
Performance comparisons were made with the standard uuid and the fastuuid library, which is written in Rust.
uuid (ms) |
fastuuid (ms) |
cpp_uuid (ms) |
|
---|---|---|---|
UUID from str |
1543 |
251 |
172 |
UUID from bytes |
1112 |
280 |
381 |
uuid4() |
2676 |
1049 |
131 |
str(uuid) |
859 |
229 |
120 |
uuid.bytes |
152 |
134 |
90 |
hash(uuid) |
151 |
104 |
56 |
compare UUIDs |
123 |
68 |
46 |
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.