Skip to main content

Python UUID module written in C++

Project description

Build status

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.

Benchmark results (10 6 times for each test)

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


Download files

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

Source Distribution

cpp-uuid-1.0.1.tar.gz (11.2 kB view hashes)

Uploaded Source

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