René's URL Explorer Experiment


Title: Divide-and-conquer strategy for intersections of unions by ahejlsberg · Pull Request #57871 · microsoft/TypeScript · GitHub

Open Graph Title: Divide-and-conquer strategy for intersections of unions by ahejlsberg · Pull Request #57871 · microsoft/TypeScript

X Title: Divide-and-conquer strategy for intersections of unions by ahejlsberg · Pull Request #57871 · microsoft/TypeScript

Description: With this PR we implement a "divide and conquer" strategy for handling large intersections of union types. Specifically, when creating an intersection with four or more constituents, some of which are unions, we divide the constituents into two groups such that A & B & C & D is processed as (A & B) & (C & D). Since intersections of unions often produce far smaller unions of intersections than the full cartesian product (due to some intersections becoming never), this can dramatically reduce the overall work at the cost of generating slightly more types (because of the temporary intersections). For example, the reduced repro from #57863 that barely passes before this PR takes 0.28s to type check. That drops to 0.08s with this PR. Fixes #57863.

Open Graph Description: With this PR we implement a "divide and conquer" strategy for handling large intersections of union types. Specifically, when creating an intersection with four or more constituents, some...

X Description: With this PR we implement a "divide and conquer" strategy for handling large intersections of union types. Specifically, when creating an intersection with four or more constituen...

Opengraph URL: https://github.com/microsoft/TypeScript/pull/57871

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.4

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:8e62eda7-bb67-161b-deab-34f836856823
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCC1E:2054A4:188E08D:201DA41:6B055390
html-safe-nonceb6dc47b6b7a44e6e419aab67d2d7cfa548a490ae63844b4e658507a6d73f4c5d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzFFOjIwNTRBNDoxODhFMDhEOjIwMURBNDE6NkIwNTUzOTAiLCJ2aXNpdG9yX2lkIjoiNjg0NTU5NDY3MDg5NTI4OTIzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0eaf887c2af0bc84693ec81f10104ab67c476efc03d35710afc73f4b74ba6af8
hovercard-subject-tagpull_request:1783281327
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/microsoft/TypeScript/pull/57871/files
twitter:imagehttps://avatars.githubusercontent.com/u/4226954?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4226954?s=400&v=4
og:image:altWith this PR we implement a "divide and conquer" strategy for handling large intersections of union types. Specifically, when creating an intersection with four or more constituents, some...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release220e980097d94ce616d5d11fbd5316d208e3fc93
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/pull/57871/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fpull%2F57871%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fpull%2F57871%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/pull/57871/files
Reloadhttps://github.com/microsoft/TypeScript/pull/57871/files
Reloadhttps://github.com/microsoft/TypeScript/pull/57871/files
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests321 (321)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmicrosoft%2FTypeScript%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmicrosoft%2FTypeScript%2Fissues%2Fnew%2Fchoose
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
mainhttps://github.com/microsoft/TypeScript/tree/main
fix57863https://github.com/microsoft/TypeScript/tree/fix57863
Conversation 23 https://github.com/microsoft/TypeScript/pull/57871
Commits 7 https://github.com/microsoft/TypeScript/pull/57871/commits
Checks 0 https://github.com/microsoft/TypeScript/pull/57871/checks
Files changed https://github.com/microsoft/TypeScript/pull/57871/files
Please reload this pagehttps://github.com/microsoft/TypeScript/pull/57871/files
Divide-and-conquer strategy for intersections of unions https://github.com/microsoft/TypeScript/pull/57871/files#top
Show all changes 7 commits https://github.com/microsoft/TypeScript/pull/57871/files
55808fe Divide-and-conquer strategy for intersections of unions ahejlsberg Mar 20, 2024 https://github.com/microsoft/TypeScript/pull/57871/commits/55808fe1fc22ac25b79a8821de9264de3c2ed5cd
43f1d44 Accept new baselines ahejlsberg Mar 21, 2024 https://github.com/microsoft/TypeScript/pull/57871/commits/43f1d44e0d53d9245da4b840295e1be53c0e93d9
a8e74ae Add tests ahejlsberg Mar 21, 2024 https://github.com/microsoft/TypeScript/pull/57871/commits/a8e74aec75cdf63faa58e6c73497ab2e04fb5b5e
5bace94 Properly cache outermost result ahejlsberg Mar 21, 2024 https://github.com/microsoft/TypeScript/pull/57871/commits/5bace9455e90b760b7cec1bafed4165dda5d8696
a83f592 Include type alias ahejlsberg Mar 21, 2024 https://github.com/microsoft/TypeScript/pull/57871/commits/a83f592783602aae1dff96bba4d9744ed6b4d4f4
72352dc Accept new baselines ahejlsberg Mar 21, 2024 https://github.com/microsoft/TypeScript/pull/57871/commits/72352dcc4f1d820b0c8031ad686e63b2048962da
df41141 Integer positions only ahejlsberg Mar 21, 2024 https://github.com/microsoft/TypeScript/pull/57871/commits/df4114146b021c1c469e0fec60b51ab21773312a
Clear filters https://github.com/microsoft/TypeScript/pull/57871/files
Please reload this pagehttps://github.com/microsoft/TypeScript/pull/57871/files
Please reload this pagehttps://github.com/microsoft/TypeScript/pull/57871/files
checker.ts https://github.com/microsoft/TypeScript/pull/57871/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
divideAndConquerIntersections.symbols https://github.com/microsoft/TypeScript/pull/57871/files#diff-8f6ae2dac704029b518a9e3a260abd3902a83938a07c0a98f57bab643faf2f23
divideAndConquerIntersections.types https://github.com/microsoft/TypeScript/pull/57871/files#diff-c3dac205c1e6b917fbe41a90ae15d0184098ccbaeecbbb41d52a86f04f2d30a4
normalizedIntersectionTooComplex.types https://github.com/microsoft/TypeScript/pull/57871/files#diff-36b66fa287050a9e51a7e08f78b18196a1a538030e2dc7c8081f0bb9499f1189
styledComponentsInstantiaionLimitNotReached.types https://github.com/microsoft/TypeScript/pull/57871/files#diff-e7bb071d4a41de99ec5d3154b14a68205b2bd934ed69cd2c9295a56cc156bd22
templateLiteralTypes1.types https://github.com/microsoft/TypeScript/pull/57871/files#diff-201930b3d98a8b9541c588446cc98cea7efaa8cff9b17484a28daa3292216f76
divideAndConquerIntersections.ts https://github.com/microsoft/TypeScript/pull/57871/files#diff-923cca586e2a2cea84e5f99dadcd2158e2882b0576d8594144d02204ec5c0718
src/compiler/checker.tshttps://github.com/microsoft/TypeScript/pull/57871/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
View file https://github.com/microsoft/TypeScript/blob/df4114146b021c1c469e0fec60b51ab21773312a/src/compiler/checker.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/57871/{{ revealButtonHref }}
https://github.com/microsoft/TypeScript/pull/57871/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
Please reload this pagehttps://github.com/microsoft/TypeScript/pull/57871/files
https://github.com/microsoft/TypeScript/pull/57871/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
tests/baselines/reference/divideAndConquerIntersections.symbolshttps://github.com/microsoft/TypeScript/pull/57871/files#diff-8f6ae2dac704029b518a9e3a260abd3902a83938a07c0a98f57bab643faf2f23
View file https://github.com/microsoft/TypeScript/blob/df4114146b021c1c469e0fec60b51ab21773312a/tests/baselines/reference/divideAndConquerIntersections.symbols
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/microsoft/TypeScript/pull/57871/files
tests/baselines/reference/divideAndConquerIntersections.typeshttps://github.com/microsoft/TypeScript/pull/57871/files#diff-c3dac205c1e6b917fbe41a90ae15d0184098ccbaeecbbb41d52a86f04f2d30a4
View file https://github.com/microsoft/TypeScript/blob/df4114146b021c1c469e0fec60b51ab21773312a/tests/baselines/reference/divideAndConquerIntersections.types
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/57871/{{ revealButtonHref }}
tests/baselines/reference/normalizedIntersectionTooComplex.typeshttps://github.com/microsoft/TypeScript/pull/57871/files#diff-36b66fa287050a9e51a7e08f78b18196a1a538030e2dc7c8081f0bb9499f1189
View file https://github.com/microsoft/TypeScript/blob/df4114146b021c1c469e0fec60b51ab21773312a/tests/baselines/reference/normalizedIntersectionTooComplex.types
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/57871/{{ revealButtonHref }}
https://github.com/microsoft/TypeScript/pull/57871/files#diff-36b66fa287050a9e51a7e08f78b18196a1a538030e2dc7c8081f0bb9499f1189
tests/baselines/reference/styledComponentsInstantiaionLimitNotReached.typeshttps://github.com/microsoft/TypeScript/pull/57871/files#diff-e7bb071d4a41de99ec5d3154b14a68205b2bd934ed69cd2c9295a56cc156bd22
View file https://github.com/microsoft/TypeScript/blob/df4114146b021c1c469e0fec60b51ab21773312a/tests/baselines/reference/styledComponentsInstantiaionLimitNotReached.types
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/57871/{{ revealButtonHref }}
https://github.com/microsoft/TypeScript/pull/57871/files#diff-e7bb071d4a41de99ec5d3154b14a68205b2bd934ed69cd2c9295a56cc156bd22
https://github.com/microsoft/TypeScript/pull/57871/files#diff-e7bb071d4a41de99ec5d3154b14a68205b2bd934ed69cd2c9295a56cc156bd22
tests/baselines/reference/templateLiteralTypes1.typeshttps://github.com/microsoft/TypeScript/pull/57871/files#diff-201930b3d98a8b9541c588446cc98cea7efaa8cff9b17484a28daa3292216f76
View file https://github.com/microsoft/TypeScript/blob/df4114146b021c1c469e0fec60b51ab21773312a/tests/baselines/reference/templateLiteralTypes1.types
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/57871/{{ revealButtonHref }}
https://github.com/microsoft/TypeScript/pull/57871/files#diff-201930b3d98a8b9541c588446cc98cea7efaa8cff9b17484a28daa3292216f76
https://github.com/microsoft/TypeScript/pull/57871/files#diff-201930b3d98a8b9541c588446cc98cea7efaa8cff9b17484a28daa3292216f76
tests/cases/compiler/divideAndConquerIntersections.tshttps://github.com/microsoft/TypeScript/pull/57871/files#diff-923cca586e2a2cea84e5f99dadcd2158e2882b0576d8594144d02204ec5c0718
View file https://github.com/microsoft/TypeScript/blob/df4114146b021c1c469e0fec60b51ab21773312a/tests/cases/compiler/divideAndConquerIntersections.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/57871/{{ revealButtonHref }}
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.