You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UUID is one of the key types, used in pretty much every modern application. And its getting even more widespread as using auto-incremented IDs in databases isn't ideal in sharded/distributed databases.
Python's UUID implementation is quite slow compared to NodeJS/Bun and other fast runtimes. This is fixable by implementing the type in C, which it should be, as it's one of the most fundamental types.
For context, I originally observed our uuid being slow when I first implemented gel-python driver years ago. It was 50% slower than its JS counterpart on a macro benchmark where UUIDs were only 10-30% of the total data, despite gel-python using C to accelerate its protocol parsing and network code. I later heard complaints about slow uuid from FastAPI core developers and other people in the ecosystem.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
Not really. But I figured this is non-controversial enough that I can give it a spin. A PR will follow shortly.
Activity
Perf: Intern Result-Field Dict Keys, and Build UUIDs Without the Pyth…
Issue #pythongh-139122: Reimplement base UUID type, uuid4(), and uuid…
pythongh-139122: Fix UUID subclass allocation and freelist type owner…
pythongh-139122: Match UUID state restoration mapping semantics
pythongh-139122: Fix UUID time hook error handling and reference updates
pythongh-139122: Align C UUID constructor inputs with Python
pythongh-139122: Make UUID narrowing and entropy lock requirements ex…
pythongh-139122: Preserve UUID fields length errors
pythongh-139122: Clarify version-specific UUID layouts
pythongh-139122: Apply UUID review cleanup
pythongh-139122: Fix concurrent UUID entropy refills and UUIDv7 state…
pythongh-139122: Avoid subclass module-state lookup during UUID deall…
pythongh-139122: Mark UUID testing hook as an explicit re-export
pythongh-139122: Document UUID performance improvements in What’s New
pythongh-139122: Match Python UUID prefix and brace parsing
pythongh-139122: Assert UUID type association is a module during deal…
pythongh-139122: Propagate SafeUUID lookup errors in is_safe getter
pythongh-139122: Honor subclass string conversion in UUID repr
Issue #pythongh-139122: Reimplement base UUID type, uuid4(), and uuid…
pythongh-139122: Fix UUID subclass allocation and freelist type owner…
pythongh-139122: Match UUID state restoration mapping semantics
pythongh-139122: Fix UUID time hook error handling and reference updates
pythongh-139122: Align C UUID constructor inputs with Python
pythongh-139122: Make UUID narrowing and entropy lock requirements ex…
pythongh-139122: Preserve UUID fields length errors
pythongh-139122: Clarify version-specific UUID layouts
pythongh-139122: Apply UUID review cleanup
pythongh-139122: Fix concurrent UUID entropy refills and UUIDv7 state…
pythongh-139122: Avoid subclass module-state lookup during UUID deall…
pythongh-139122: Mark UUID testing hook as an explicit re-export
pythongh-139122: Document UUID performance improvements in What’s New
pythongh-139122: Match Python UUID prefix and brace parsing
pythongh-139122: Assert UUID type association is a module during deal…
pythongh-139122: Propagate SafeUUID lookup errors in is_safe getter
pythongh-139122: Honor subclass string conversion in UUID repr
pythongh-139122: Normalize line endings in UUID review suggestions
pythongh-139122: Test UUID state restoration with frozendict
pythongh-139122: Use shared hex conversion helper for UUID.hex
pythongh-139122: Format UUIDs directly into the result string
pythongh-139122: Narrow UUID exception assertions and clean up test s…
gh-139122: Reimplement base UUID type, uuid4(), and uuid7() in C (#13…
pythongh-139122: Implement uuid6 in C with OS entropy and cached node…
picnixz commentedon Oct 22, 2026
cf69000: UUIDv7 is now implemented in C and boosts 30x performance. UUIDv4 are also implemented.
pythongh-139122: Defer UUIDv6 benchmark executor import until execution
pythongh-139122: Use time hooks in UUIDv6 tests
pythongh-139122: Align UUIDv6 hook arguments
pythongh-139122: Add node hooks for UUIDv6 tests
pythongh-139122: Keep UUIDv6 benchmark in PR description