Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng
#751 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php, symfony
Lĩnh vực
backend, performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
PHP
Star
1.7k
Fork
166
Merge trung bình
11 giờ 20 phút
Pull request đã merge (30 ngày)
37

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của goaop/framework

Tất cả issue của goaop/framework

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.