Skip to content

Comments

Faster Ternary analysis#5015

Open
staabm wants to merge 1 commit intophpstan:2.1.xfrom
staabm:fast-tern
Open

Faster Ternary analysis#5015
staabm wants to merge 1 commit intophpstan:2.1.xfrom
staabm:fast-tern

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Feb 21, 2026

before this PR

➜  phpstan-src git:(2.1.x) ✗ hyperfine 'vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug14100'
Benchmark 1: vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug14100
  Time (mean ± σ):      1.739 s ±  0.006 s    [User: 1.571 s, System: 0.165 s]
  Range (min … max):    1.734 s …  1.754 s    10 runs
 
➜  phpstan-src git:(2.1.x) ✗ hyperfine 'vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug14100'
Benchmark 1: vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug14100
  Time (mean ± σ):      1.735 s ±  0.009 s    [User: 1.567 s, System: 0.165 s]
  Range (min … max):    1.730 s …  1.759 s    10 runs

with this PR

➜  phpstan-src git:(fast-tern) ✗ hyperfine 'vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug14100'
Benchmark 1: vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug14100
  Time (mean ± σ):      1.668 s ±  0.009 s    [User: 1.502 s, System: 0.163 s]
  Range (min … max):    1.661 s …  1.689 s    10 runs
 
➜  phpstan-src git:(fast-tern) ✗ hyperfine 'vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug14100'
Benchmark 1: vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug14100
  Time (mean ± σ):      1.663 s ±  0.004 s    [User: 1.498 s, System: 0.162 s]
  Range (min … max):    1.659 s …  1.670 s    10 runs

@staabm staabm marked this pull request as ready for review February 21, 2026 09:48
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

);
} else {
$conditionExpr = new BooleanOr(
$expr->cond,
Copy link
Contributor Author

@staabm staabm Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before this PR, we had redundant work in this 1st OR-operand new BooleanAnd($expr->cond, $expr->cond),

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.

2 participants