Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Performance: cache warmup walks the application tree twice and descends into excluded directories

クローズ
#751 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php, symfony

調査の方向性

Start with src/Instrument/ClassLoading/CacheWarmer.php and src/Instrument/FileSystem/Enumerator.php, then read the related Enumerator and CacheWarmer tests. Check how the Finder iterator is counted, rewound, and filtered, including wildcard exclusions, before changing the traversal. Done means the same files are processed, excluded directories are pruned safely, the tests cover both classes, and timing is compared on a tree with a large excluded directory.

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

説明

Enhancement Performance

Problem

  • Two walks: CacheWarmer::warmUp() counts the files with iterator_count($iterator) and then calls $iterator->rewind() (src/Instrument/ClassLoading/CacheWarmer.php:80-84). Rewinding the Finder iterator walks the whole appDir again, calling getRealPath() and the path filter for every file.
  • No pruning: Enumerator::enumerate() (src/Instrument/FileSystem/Enumerator.php:54-61) applies the include/exclude filter per file only. Finder still descends into every excluded directory: the cache directory, the framework's runtime dependencies, and user excludePaths such as vendor/ or node_modules/.

Measurement

appDir = vendor/ (3,942 PHP files): count pass 53 ms, second pass 44 ms. The cost grows with the size of excluded trees, which can be much larger than the woven code, for example a full vendor/ plus node_modules/ under the app root.

Proposal

  • One walk: collect the iterator once (iterator_to_array(..., false), which also removes the separate Windows rewind workaround), then count and process from that array.
  • Prune excluded directories: use Finder's filter(..., prune: true), available since symfony/finder 6.4 (the framework requires ^7.4 || ^8.0), or exclude() with paths relative to in(). Match the directory against the same prefix regex as getPathFilter(). Exclude patterns with * wildcards that could still match files inside a directory must not prune it.

Acceptance

  • The warmup processes exactly the same files as before; extend the Enumerator and CacheWarmer tests.
  • A timing of the enumeration before and after on a tree with a large excluded directory.

Estimate

Halves the enumeration time, and more when large excluded trees sit under appDir. Low risk, small change.

主要言語
PHP
スター
1.7k
フォーク
166
平均マージ
20時間 56分
マージ済み PR(30日)
45

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

goaop/framework のほかの issue

goaop/framework の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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