python / python/cpython

Parallelize deepfreeze.py

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

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

3.13 build type-feature
主要言語
Python
スター
77.2k
フォーク
36k
平均マージ
1日 9時間
マージ済み PR(30日)
558

説明

Feature or enhancement

I propose to parallelize deepfreezing to speed up compile time for core devs.

Pitch

deepfreezing / deepfreeze.py is a choke point for building CPython. Deepfreezing happens very late in the build process and takes considerable amount of time, especially for pydebug builds. Deepfreezing is a single process and does not benefit from multiple cores. Every build that touches a core file will result in re-freezing. On my system and with ccache populates, make spends between 60 to 75% time just in deepfreeze.py for debug builds. For regular builds it's about 25-30% of total build time.

$ ./configure -C --with-pydebug
$ make clean
$ time make

real    0m9,339s
user    0m13,630s
sys     0m2,657s
$ rm Python/deepfreeze/deepfreeze.c
$ time make Python/deepfreeze/deepfreeze.c

real    0m7,267s
user    0m7,033s
sys     0m0,204s

The process can be parallelized. One possible solution is to split the work. For each input module create a make rule that outputs an inc file, e.g. Python/deepfreeze/"importlib._bootstrap.inc. An another rules creates deepfreeze.c with #include "importlib._bootstrap.inc, ... This keeps all code in one object file.

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

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

はじめの一歩

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

調査の方向性

Python/deepfreeze/deepfreeze.py と issue に示されている build コマンドから始め、Python/deepfreeze/deepfreeze.c がどのように生成されるかを追跡します。入力ごとに .inc を出力する提案と build ルールを評価します。deepfreezing が複数のコアを使用でき、必要な deepfreeze.c の出力を生成し、現在の build フローを維持できれば完了です。

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

評価

技術スタック
python
領域
build-system
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

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

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