Skip to content

Implement UUID functions and type in C #139122

Open

Description

@1st1

Feature or enhancement

Proposal:

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.

Linked PRs

Activity

  1. added 3 commits that reference this issue on Sep 18, 2025
  2. corona10 commented on Sep 18, 2025

    @corona10
    Member

    I agree with this issue, as many people are starting to use UUIDs as primary keys in databases. This will definitely improve performance in Python.

  3. picnixz commented on Sep 18, 2025

    @picnixz
    Member

    As the one who implemented v6, v7, v8 and fixed v1, I also support this idea. I decided not to write the implementation in C first so that we match the RFC quite easily but making UUID faster was on my todolist (so thanks for taking up the task)

  4. changed the title [-]Speedup uuid[/-] [+]Implement UUID functions and type in C[/+] on Sep 18, 2025
  5. added 4 commits that reference this issue on Sep 19, 2025
  6. self-assigned this
    on Mar 29, 2026
  7. added a commit that references this issue on Mar 29, 2026
  8. 34 remaining items

  9. added 8 commits that reference this issue on Oct 21, 2026
  10. removed their assignment
    on Oct 21, 2026
  11. picnixz commented on Oct 22, 2026

    @picnixz
    Member

    cf69000: UUIDv7 is now implemented in C and boosts 30x performance. UUIDv4 are also implemented.

  12. added 5 commits that reference this issue on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirperformancePerformance or resource usagetype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions