Skip to content

[perf] Key config by old name in 7 Transform rules - #8742

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

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

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Batch B of the configurable-rule config-scan cleanup (follows #8734 / #8735 / #8736 / #8739). Seven Transform rules scanned their whole configured list/map per visited node, running isName() on each entry.

rule node key
ConstFetchToClassConstFetchRector ConstFetch old const name
FuncCallToStaticCallRector FuncCall old func name
FuncCallToNewRector FuncCall func name (keyed map)
StaticCallToFuncCallRector StaticCall method
StaticCallToNewRector StaticCall method (class check kept inside)
MethodCallToFuncCallRector MethodCall method
MethodCallToStaticCallRector MethodCall old method

Each resolves the node name once and looks the config up by lowercased name - a keyed map, or a bucket built once in configure(). 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/transform_funccall_to_staticcall_bucket_bench.php (400 entries, 200 non-matching calls, CPU time):

us/call
before 1875.1
after 3.4

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

ConstFetchToClassConstFetchRector, FuncCallToStaticCallRector, FuncCallToNewRector, StaticCallToFuncCallRector, StaticCallToNewRector, MethodCallToFuncCallRector and MethodCallToStaticCallRector each scanned their whole configured list/map per visited node, running isName() on each entry. Resolve the node name once and look it up by lowercased name (keyed map, or a bucket built in configure()). Any object-type / class check stays inside the matched branch.

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

bench/transform_funccall_to_staticcall_bucket_bench.php (400 entries, 200 non-matching calls): 1875.1 -> 3.4 us/call.
@TomasVotruba
TomasVotruba merged commit f3e63ff into main Oct 20, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-perf-transform-bucket branch October 20, 2026 19:50
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