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

Performance: parser-reflection builds a PHP parser on every request (~175 µs)

Chiusa
#730 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à
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
performance

Direzione di ricerca

Read src/bootstrap.php, which calls ReflectionEngine::init(new ComposerLocator()), then ReflectionEngine::parseFile() and locateClassFile() to see where the parser and locator are actually needed. The fix spans two repositories: make parser/locator creation lazy in parser-reflection (dropping or emptying the composer files entry), cut a release, then raise the constraint in this repo's composer.json. Done looks like a warm request no longer builds the Php8 parser and the ~175 µs bootstrap cost disappears.

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

Descrizione

Enhancement Performance

Problem

goaop/parser-reflection registers src/bootstrap.php as a composer files autoload entry. On every request it calls ReflectionEngine::init(new ComposerLocator()), which builds the Php8 parser and lexer.

The framework parses only on a cache miss (StreamMetaData → ReflectionEngine::parseFile()), so a warm production request never uses this parser. It is still built on every request by every app that has the framework installed, even one that never starts an aspect kernel.

Measurement

Warm opcache (built-in server, opcache.validate_timestamps=0, median of 100–200 requests), small app with 25 woven classes:

phase µs
parser-reflection bootstrap (inside composer autoload) ~176
whole AspectKernel::init() ~143
total extra cost of AOP vs plain composer ~405

The bootstrap alone costs more than the whole kernel init.

Proposal

  • In parser-reflection: create the parser and locator lazily on the first ReflectionEngine::getParser() / parseFile() / locateClassFile() call, and make the files bootstrap free (or drop it).
  • Release parser-reflection, then raise the constraint in this repository's composer.json.

Estimate

About −175 µs on every request, roughly 30% of the per-request cost the framework adds today. Low risk, small change, but it needs a parser-reflection release.

Lingua principale
PHP
Stelle
1.7k
Fork
166
Merge medio
9h 50m
PR unite (30g)
30

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.