Skip to content

[perf] Bucket value-object renames by old name in 4 Renaming rules - #8739

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

TomasVotruba merged 1 commit into
mainfrom
tv-perf-rename-vo-bucket

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Batch A of the configurable-rule config-scan cleanup (follows #8734 / #8735 / #8736). Four more Renaming rules held a flat list of value objects and scanned the whole list per visited node, running isName() on each entry before the object-type check.

rule node bucket key
RenameStaticMethodRector StaticCall old method
RenameClassConstFetchRector ClassConstFetch old constant
RenamePropertyRector (per-fetch path) PropertyFetch / StaticPropertyFetch old property
RenameAttributeRector attribute name old attribute

Each builds a bucket keyed by lowercased old name once in configure(), so a node only visits the entries sharing its name; the object-type / class-type check stays inside the per-bucket branch. The lowercased bucket matches the case-insensitive isName() these rules already used, so behaviour is unchanged. RenamePropertyRector's ClassLike branch (looks a property up by name directly) is left as is.

Numbers

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

us/call
before 1002.9
after 2.3

Scales with configured-list size. Full rules-tests/Renaming (107 tests) green, PHPStan and ECS clean.

RenameStaticMethodRector, RenameClassConstFetchRector, RenamePropertyRector (per-fetch path) and RenameAttributeRector 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 name once in configure(), so a node only visits the entries sharing its name.

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

bench/rename_static_method_bucket_bench.php (400 renames, 200 non-matching calls): 1002.9 -> 2.3 us/call.
@TomasVotruba
TomasVotruba merged commit f908343 into main Oct 20, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-perf-rename-vo-bucket branch October 20, 2026 19:43
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