Repository navigation
Commit c116397
Intersect an intersection's mapped members at once unless two are unions
IntersectionType::traverse(), traverseSimultaneously() and the
intersectTypes() helper (tryRemove() and friends) folded the mapped members
back together two at a time. Every step re-reduces the growing intersection
pairwise, so rebuilding n members costs O(n^3) pair checks instead of the
O(n^2) of one TypeCombinator::intersect() over all of them.
The fold exists to keep two or more unions from being distributed over each
other at once (a79f4ca, b26d08c); with at most one union operand there
is nothing to multiply, so those intersections go through the n-ary call.
The isset() of 26 offsets in the bug-15061 bench narrows the native mixed
subject to (non-empty-array & hasOffset(...) x25) | (ArrayAccess & ...), and
since the falsey isset() narrowing removes hasOffset() of optional keys
(77527df), every subject rebuilds that intersection: without the native
extension the file's analysis time drops by 26%.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JsHiTmsN24NMF7zvEhwbip1 parent 9f1ff68 commit c116397
3 files changed
Lines changed: 57 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1724 | 1724 | | |
1725 | 1725 | | |
1726 | 1726 | | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
1730 | | - | |
1731 | | - | |
| 1727 | + | |
1732 | 1728 | | |
1733 | 1729 | | |
1734 | 1730 | | |
| |||
1765 | 1761 | | |
1766 | 1762 | | |
1767 | 1763 | | |
1768 | | - | |
1769 | | - | |
1770 | | - | |
1771 | | - | |
1772 | | - | |
| 1764 | + | |
1773 | 1765 | | |
1774 | 1766 | | |
1775 | 1767 | | |
| |||
1897 | 1889 | | |
1898 | 1890 | | |
1899 | 1891 | | |
1900 | | - | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
1901 | 1917 | | |
1902 | 1918 | | |
1903 | 1919 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2008 | 2008 | | |
2009 | 2009 | | |
2010 | 2010 | | |
2011 | | - | |
2012 | | - | |
| 2011 | + | |
| 2012 | + | |
2013 | 2013 | | |
2014 | 2014 | | |
2015 | 2015 | | |
| |||
2028 | 2028 | | |
2029 | 2029 | | |
2030 | 2030 | | |
2031 | | - | |
| 2031 | + | |
2032 | 2032 | | |
2033 | 2033 | | |
2034 | 2034 | | |
| |||
2093 | 2093 | | |
2094 | 2094 | | |
2095 | 2095 | | |
2096 | | - | |
| 2096 | + | |
2097 | 2097 | | |
2098 | 2098 | | |
2099 | 2099 | | |
| |||
2656 | 2656 | | |
2657 | 2657 | | |
2658 | 2658 | | |
2659 | | - | |
2660 | | - | |
| 2659 | + | |
| 2660 | + | |
2661 | 2661 | | |
2662 | 2662 | | |
2663 | 2663 | | |
| |||
2674 | 2674 | | |
2675 | 2675 | | |
2676 | 2676 | | |
2677 | | - | |
| 2677 | + | |
2678 | 2678 | | |
2679 | 2679 | | |
2680 | | - | |
2681 | | - | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
2682 | 2684 | | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
2683 | 2691 | | |
2684 | 2692 | | |
2685 | 2693 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
| |||
528 | 530 | | |
529 | 531 | | |
530 | 532 | | |
| 533 | + | |
| 534 | + | |
531 | 535 | | |
532 | 536 | | |
533 | | - | |
| 537 | + | |
534 | 538 | | |
535 | 539 | | |
536 | 540 | | |
| |||
683 | 687 | | |
684 | 688 | | |
685 | 689 | | |
686 | | - | |
687 | | - | |
688 | | - | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
689 | 694 | | |
690 | 695 | | |
691 | 696 | | |
| |||
0 commit comments