Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Cerrado
#751 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php, symfony

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
PHP
Estrellas
1.7k
Forks
166
Merge medio
11 h 20 min
PR fusionados (30 d)
37

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de goaop/framework

Todos los issues de goaop/framework

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.