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

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

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php
領域
performance

調査の方向性

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.

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

説明

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.

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

環境構築

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

はじめの一歩

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

goaop/framework のほかの issue

goaop/framework の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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