Boot-time profiling: span instrumentation + benchmark harness - #588
Closed
lisachenko wants to merge 1 commit into
Closed
Boot-time profiling: span instrumentation + benchmark harness#588lisachenko wants to merge 1 commit into
lisachenko wants to merge 1 commit into
Conversation
…rness
Adds Go\Instrument\BootTimer (enabled only when GO_AOP_BENCH_SPANS is set,
single static bool check when off) with hrtime spans around each boot phase
of AspectKernel::init, per-lazy-service container registration, cache-state
include, autoloader findFile and transformer hot spots.
Adds tests/Benchmark/{bench-request,run-bench}.php: simulated fixture-app
request (boot + woven class autoload + first intercepted call) and a matrix
orchestrator (cold/warm, opcache file cache to emulate persistent opcache,
median/p10/p90 over N runs). Adds a 'production' (debug=false) profile to
the fixture project configuration with an isolated cache directory.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1Z87HZ2iz23WPTtTYqFxE
Member
Author
|
It isn’t valid direction to commit this into main code and PR. Declining this - only for local development and checks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
First step of the hot-start boot-time optimization work for 4.0: measurement infrastructure.
Go\Instrument\BootTimer— a tiny boot profiler that is disabled unless theGO_AOP_BENCH_SPANSenv var points to an output file (a single static bool check per call when off, so it can live in the hot path permanently). Records hrtime spans with per-span autoloaded-file and memory deltas, plus aggregate counters, and dumps a JSON report on shutdown.AspectKernel::initsub-steps (normalizeOptions, container construction, stream-filter registration, transformer registration, composer-loader init,configureAop), per-serviceContainer::addLazyService, the_transformation.cacheinclude inCachePathManager,AopComposerLoader::findFile(composer lookup / realpath / cache-hit / filter-rewrite counters), and the transformer cold path (SourceTransformingLoader::filterparse,CachingTransformerweave + cached-reparse).tests/Benchmark/—bench-request.phpsimulates one request against the fixture project (kernel boot + autoload of woven classes + first intercepted call);run-bench.phporchestrates the cold/warm matrix across PHP binaries, using an opcache file cache to emulate a persistent server opcache in CLI runs, and reports median/p10/p90.productionconfiguration profile (debug => false, isolated cache dir) so the warm-cache production fast path can be measured next to the existing debug profile.Why
Baseline numbers and a per-phase breakdown are needed before the planned 4.0 boot-time optimizations (lazy transformer registration, truly-lazy container services, lazy aspect registration, real
PREBUILT_CACHEmode, opcache-friendly cache state). Follow-up commits on this branch will add the measured results and the optimizations themselves.Notes
GO_AOP_BENCH_SPANSis not set.🤖 Generated with Claude Code
https://claude.ai/code/session_01V1Z87HZ2iz23WPTtTYqFxE
Generated by Claude Code