Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa
#751 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php, symfony

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
PHP
Stelle
1.7k
Fork
166
Merge medio
11h 20m
PR unite (30g)
37

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di goaop/framework

Tutte le issue di goaop/framework

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.