Performance: let debug mode serve fresh woven classes from OPcache (debug hot request 13 ms vs 5.5 ms in production)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 28/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- php
- 領域
- backend, performance
調査の方向性
Start by reading follow-up issue #745, the freshness work tracked in #815, and the transformation performance test named in the acceptance criteria. Compare the three proposed loading approaches, focusing on XDebug breakpoint mapping and magic constants before proposing a design. Done means an approved approach preserves woven output, cache maps, and magic constants; avoids woven-file reads and recompilation on hot debug requests; and still re-weaves changed sources.
索引モデルが issue の本文から書いたものです。
説明
Implementation note: start in plan mode. XDebug breakpoint mapping and magic constants need an approved design before any code is written.
Measured with goaop/shop-demo (PHP 8.5.12, framework b755e57). Follow-up of #745, which made fresh untransformed files opcache-cached in debug mode and deliberately kept woven files on the filter.
Problem
In debug mode every woven class is loaded through php://filter/read=go.source.transforming.loader/resource=<original>. OPcache never caches a filtered include, so on every request each woven class:
- is checked for freshness (
filemtime,filesize,isFreshSince()); - has its cached copy read with
file_get_contents(); - is compiled from scratch.
Measurement (hot request, OPcache warm, 94 woven classes)
debug => true |
debug => false |
|
|---|---|---|
| request time | 13.0 ms | 5.5 ms |
filemtime / filesize calls |
323 / 239 | 0 / 0 |
file_get_contents calls |
94 | 0 |
| profiled share of class loading + cache metadata | 20 % | 6 % |
(323 filemtime includes ~84 redundant re-stats of tracked resources, tracked in #815.)
Why the filter is used today
Debug mode serves woven code through the filter so that PHP reports the original path for the included file. XDebug breakpoints set in the original source then hit, and __FILE__/__DIR__ of the woven body point at the original file (#679).
Options to evaluate in the plan
- Opt-in flag (e.g. a
Features::bit or adebugsub-option): include fresh woven files by their cache path, like production. Breakpoints then have to be set in the cache files, or mapped by the IDE (path mappings), and magic constants are already rewritten byMagicConstantTransformer. - Automatic: use the cache path when no step debugger is active (
xdebug_info('mode')withoutdebug, orextension_loaded('xdebug') === false), and the filter otherwise. This keeps the freshness checks either way. - Keep the filter but make it cheaper (no
file_get_contents()of a separate file, e.g. by reading the cached content through the stream directly). The compile cost remains.
Acceptance
- Woven output, cache maps and magic constants identical with and without the new path.
- With the new path, a hot debug request does no
file_get_contents()for woven classes and no compilation (OPcache hits), measured with the shop demo or the fixture project. - A changed source is still re-woven on the next debug request.
composer test,composer analyze;composer test:performance:transformationunchanged.
Estimate
Up to −7 ms per debug request on this app (proportional to the number of woven classes loaded). High: debugger integration semantics, design decision, cross-platform paths.
Generated by Claude Code
- 主要言語
- PHP
- スター
- 1.7k
- フォーク
- 166
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 42
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
goaop/framework のほかの issue
-
Enhancement Performance
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
`PREBUILT_CACHE` weaves and writes the cache when a class is missing from it (fails on read-only file systems)対応中かも @lisachenko が今日担当しました。 オープンBug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Enhancement PHP-8.6
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Enhancement PHP-8.6 To Be Discussed
難易度 4/5 1週間以上 初心者へのやさしさ 8/100
メンテナーはふだん 1 日以内に返信
-
Enhancement PHP-8.6
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
メンテナーはふだん 1 日以内に返信
goaop/framework の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FriendsOfFlarum/synopsis#16 ·
-
bug javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
simplesamlphp/simplesamlphp#2693 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
FinanceFlash/unvibecode#577 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信