Skip to content

[perf] Check method name before type inference in ExecuteQueryParamsToBindValueRector - #537

Merged
TomasVotruba merged 1 commit into
mainfrom
perf-doctrine-execute-query-name-guard
Oct 21, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
perf-doctrine-execute-query-name-guard

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

What

The rule walks the statements of a stmts-aware node and, for every MethodCall it finds, ran isObjectType() (type inference) on the caller before checking the method name - so type resolution ran on every method call in the body, including the majority that are not executeQuery() and bail on the name anyway.

Reorders the NodeFinder predicate to compare the cheap method name first. Pure reorder - both conditions are still ANDed.

Numbers

Micro bench (bench/execute_query_params_name_guard_bench.php, shipped here), refactor() over a method body of 300 non-executeQuery calls, 200 repeats, CPU (user+sys):

us/call
before (type-first) ~17.7
after (name-first) ~14.1

~1.25x on the common bail path (the statement walk itself dominates the rest). Full test suite stays green (306 tests).

@TomasVotruba
TomasVotruba merged commit 779c8db into main Oct 21, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the perf-doctrine-execute-query-name-guard branch October 21, 2026 06:42
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