python / python/cpython

Minor optimization for set object, swap bodies

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

まだ誰も着手していません。

interpreter-core performance type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Based on this observation:

https://github.com/python/cpython/pull/132290#discussion_r2403137517

set_swap_bodies is only called in two locations in this file. For both cases the second argument b is a newly created temporary which is discarded afterwards. So we could replace part (all?) of these branches with asserts. Part of the other work (e.g. copying back to b) might not be needed for the same reason.

We should investigate this idea and see if it's worth it.

Linked PRs
  • gh-148155

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

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

はじめの一歩

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

調査の方向性

まず、参照先のファイルにある set_swap_bodies とその2つの呼び出し箇所を読み、次に PR 132290 のリンクされた議論を確認してください。一時的な第2引数が常に破棄されているか、またコピーし戻す必要がないかを確認してください。提案された簡略化が動作を維持するかどうかを判断して文書化できれば完了です。PR 148155 は、すでに作業が進行中であることを示しています。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
backend
issue の種類
リファクタリング
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
20/100

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

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