python / python/cpython

Implement UUID functions and type in C

未关闭
#139,122 2 条评论 3 个 reaction 已指派 1 人 在 GitHub 查看

@picnixz 已经在做这个了。

开始于 2026年3月29日。

extension-modules performance type-feature
主要语言
Python
星标
77.2k
派生
36k
PR 合并指标
PR 指标待抓取

描述

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
  • gh-139123

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。