python / python/cpython

Improve _Py_yield to use light weight cpu instruction

オープン
#144,586 コメント 3 件 リアクション 0 件 担当者 1 名 GitHub で見る

@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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。