Skip to content

[perf] Key config by old name in Arguments/Removing rules - #8743

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-perf-args-bucket
Oct 20, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-perf-args-bucket

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Batch C of the configurable-rule config-scan cleanup (follows #8734 / #8735 / #8736 / #8739 / #8742). Four Arguments/Removing rules scanned their whole configured list per visited node, running isName() on each entry.

rule node key
RemoveMethodCallParamRector MethodCall / StaticCall method
ArgumentAdderRector MethodCall / StaticCall / Class_ method (both call + class-method loops)
ArgumentRemoverRector MethodCall / StaticCall / ClassMethod method
RemoveFuncCallRector Expression (FuncCall) function name set (isset)

Each builds a bucket keyed by lowercased old method name once in configure(); RemoveFuncCallRector flips its flat name list to a lowercased array<string,true> set. Any object-type / class-type check stays inside the matched branch. The lowercased key matches the case-insensitive isName() these rules already used, so behaviour is unchanged.

Numbers

bench/remove_method_call_param_bucket_bench.php (400 entries, 200 non-matching calls, CPU time):

us/call
before 1000.6
after 1.8

Scales with configured-list size. Full rules-tests/Arguments + rules-tests/Removing (33 tests) green, PHPStan and ECS clean.

RemoveMethodCallParamRector, ArgumentAdderRector and ArgumentRemoverRector each scanned their whole configured value-object list per visited node, running isName() on each entry before the object-type check. Bucket the list by lowercased old method name once in configure(). RemoveFuncCallRector flips its flat function-name list to a lowercased name set.

The lowercased key matches the case-insensitive isName() lookup these rules already used, so behaviour is unchanged.

bench/remove_method_call_param_bucket_bench.php (400 entries, 200 non-matching calls): 1000.6 -> 1.8 us/call.
@TomasVotruba
TomasVotruba merged commit 39deace into main Oct 20, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-perf-args-bucket branch October 20, 2026 19:58
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