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

1288

246

176

UUID from bytes

1182

259

307

uuid4()

2923

996

285

str(uuid)

891

192

100

uuid.bytes

128

109

67

hash(uuid)

206

93

48

compare UUIDs

142

61

35

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.0.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