python / python/mypy

Re-work how fine grained targets are processed

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

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

needs discussion performance priority-1-normal refactoring topic-fine-grained-incremental
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

Currently, fine grained targets are processed per updated module. This can lead to files being processed multiple times (and also a bit hard to reason, but this may be subjective). I propose to reorganise them to be processed in topologically sorted order. So the algorithm would be like this:

  1. Process all edited files, calculate all fired triggers, chain them to find all invalid targets, check for blocking errors.
  2. Group targets per module, order them per SCC, then per same heuristics we use to order modules within SCCs in coarse grained incremental. Within module targets are ordered by line number, this is unchanged.
  3. Process targets in one module from the queue, calculate updated deps and fired triggers, update invalid targets queue (maintaining the sort order), check blockers
  4. Continue step 3 until no modules left in the queue at this SCC
  5. Flush error messages
  6. Continue steps 3-5 until no SCCs left

This way it is much less likely that we will reprocess the same module twice. This will probably give an especially significant performance gain for cold runs, where many modules are updated w.r.t. to remote cache. Also IMO this algorithm is easier to reason about (and more similar to what happens in coarse-grained mode).

This idea appeared some time ago, but was postponed. Filing an issue to not forget about this.

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

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

はじめの一歩

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

調査の方向性

まず、既存の細粒度インクリメンタル処理と粗粒度のモジュール順序付けロジックを追跡します。現在の更新されたモジュールごとのフローを、提案されているSCC順のターゲットキューと比較します。これにはブロッカーのチェックとエラーのフラッシュを含めます。ターゲットが指定された順序で処理され、不要なモジュールの再処理がなく、パフォーマンスと動作が検証されていれば完了です。

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

評価

技術スタック
python
領域
compilers
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

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

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