Repository navigation
Commit ef3fe97
committed
Cache per-guard
- Both the forward (`guard`-supertype-of-`their`) and reverse (`their`-supertype-of-`guard`) `isSuperTypeOf()` checks in the guard-selection loop depend only on the guard expression, not on the target `$exprString` being iterated. They were recomputed once per (target, guard) pair, an O(N*M) redundancy that is very expensive on big union / constant-array types.
- Cache both results per `$guardExprString` in local arrays, so each pair of supertype checks runs at most once per guard per branch merge.
- Keep the reverse check (added in #5848 for the enum-guard false positive fixed by bug-14807) as the last operand of the OR so it is only computed when the cheaper forward-based conditions did not already decide — it is now also memoized.
- This neutralizes both the #5848 reverse-check cost and the #5876 target-count amplification that compounded in the same machinery: bug-14462.php ~-31%, bug-10538.php ~-21% locally, while all analysis output (including bug-14807) is unchanged.isSuperTypeOf() results in createConditionalExpressions() instead of recomputing them per target1 parent c473981 commit ef3fe97
1 file changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3901 | 3901 | | |
3902 | 3902 | | |
3903 | 3903 | | |
| 3904 | + | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
| 3908 | + | |
| 3909 | + | |
| 3910 | + | |
| 3911 | + | |
3904 | 3912 | | |
3905 | 3913 | | |
3906 | 3914 | | |
| |||
3924 | 3932 | | |
3925 | 3933 | | |
3926 | 3934 | | |
3927 | | - | |
3928 | | - | |
| 3935 | + | |
3929 | 3936 | | |
| 3937 | + | |
| 3938 | + | |
| 3939 | + | |
3930 | 3940 | | |
3931 | 3941 | | |
3932 | | - | |
3933 | 3942 | | |
3934 | 3943 | | |
3935 | 3944 | | |
| |||
3940 | 3949 | | |
3941 | 3950 | | |
3942 | 3951 | | |
| 3952 | + | |
3943 | 3953 | | |
3944 | 3954 | | |
3945 | 3955 | | |
| |||
0 commit comments