Skip to content

[perf] Profile the real worker in hotspot profiler via --xdebug - #8747

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-fix-hotspot-profiler-xdebug
Oct 20, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-fix-hotspot-profiler-xdebug

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

The committed scripts/rector-hotspot-profile.php drove bin/rector process under the Xdebug profiler but omitted the --xdebug flag.

Without that flag, Rector's XdebugHandler restarts the process without xdebug before the container boots, so the cachegrind only covered the thin pre-restart launcher - every run showed proc_close plus bootstrap and zero Rector\/PHPStan\ processing rows, making the profiler useless for its stated purpose (finding processing hot spots).

Passing --xdebug skips the restart and keeps xdebug live for the real in-process run, which --withoutParallel() (already in the generated config) keeps in this same process - no worker child.

Smoke-tested on rules/Php74: the profile now ranks the actual work (FileTypeMapper::processNodes, NodeScopeResolver, RectorRunner::run), not bootstrap.

One-line change to the profiled command plus an explanatory comment.

Without --xdebug, Rector's XdebugHandler restarts the process without
xdebug before the container boots, so the cachegrind only covered the
thin pre-restart launcher (proc_close + bootstrap, no processing rows).

Passing --xdebug skips the restart and keeps xdebug live for the real
in-process run, which --withoutParallel() already keeps in this same
process. The profile now ranks the actual FileTypeMapper / NodeScopeResolver
/ RectorRunner work.
@TomasVotruba
TomasVotruba merged commit 8c738d0 into main Oct 20, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-fix-hotspot-profiler-xdebug branch October 20, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant