Extend and improve `LOAD_COMMON_CONSTANT`
オープン
まだ誰も着手していません。
interpreter-core
performance
type-feature
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Currently LOAD_COMMON_CONSTANT only loads 7 not-so-common constants and does so fairly inefficiently.
It could be improved in two ways:
- Add some more constants, especially
None, but also"",True,Falseand-1 Make the constants that it does load both statically allocated and immortal to avoid the pointer chasing and incref operation. Onlyanyandallwould need changing.
After some consideration, I think it best to leave the common constants table per interpreter, and not statically allocate them.
- The changes to
anyandallmay be breaking. - We also need to handle
AssertionErrorandNotImplementedErrorwill be tricky to make static
They should all be immortal though, and stored as _PyStackRefs not PyObject *s.
Linked PRs
- gh-148971
- gh-149625
- gh-149688
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
LOAD_COMMON_CONSTANT エントリーポイントから始め、インタープリターごとの共通定数テーブルが値をどのように保存し、返すかを調べます。設計を変更する前にリンクされた PR を確認し、特に _PyStackRef、不滅性、any/all に関する考慮事項を確認します。None、空文字列、True、False、-1 を含む、合意された共通定数が、却下された静的割り当てアプローチを使わずに扱われれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100