Improve _Py_yield to use light weight cpu instruction
未关闭
@corona10 已经在做这个了。
开始于 2026年2月8日。
interpreter-core
performance
topic-free-threading
type-feature
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Proposal:
_Py_yield() currently relies on sched_yield()/SwitchToThread(), which are OS-level syscalls. We can replace these with lightweight CPU pause instructions (x86 PAUSE, AArch64 WFE, etc.) as CPython's bundled mimalloc already does in mi_atomic_yield(): https://github.com/python/cpython/blob/e682141c495c2e52368c4341ae54eea041070356/Include/internal/mimalloc/mimalloc/atomic.h#L323-L389
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-144587
- gh-149784
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。