Repository navigation
[perf] Key config by old name in 7 Transform rules - #8742
Merged
Merged
Conversation
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.
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ConstFetchToClassConstFetchRectorFuncCallToStaticCallRectorFuncCallToNewRectorStaticCallToFuncCallRectorStaticCallToNewRectorMethodCallToFuncCallRectorMethodCallToStaticCallRectorEach 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-insensitiveisName()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):Scales with configured-list size. Full
rules-tests/Transform(41 tests) green, PHPStan and ECS clean.