Skip to content

Cheap check first in dereferenceLhsRequiresParens()#1160

Open
staabm wants to merge 1 commit into
nikic:masterfrom
staabm:patch-1
Open

Cheap check first in dereferenceLhsRequiresParens()#1160
staabm wants to merge 1 commit into
nikic:masterfrom
staabm:patch-1

Conversation

@staabm

@staabm staabm commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

do simple bool comparison before going the more expensive route via another method call

born from a PHPStan case in which pretty printing of a files expressions turn into the main bottleneck
grafik

repro:
run phpstan on https://github.com/phpstan/phpstan-src/blob/7e97b9e67a506cd056ed3f34ad739a388c6d7942/tests/bench/data/nullsafe-chain-walk.php like
phpstan analyze nullsafe-chain-walk.php --debug


this PR does not resolve this bottleneck though

@staabm staabm changed the title Cheap check first in dereferenceLhsRequiresParens() Cheap check first in dereferenceLhsRequiresParens() Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant