René's URL Explorer Experiment


Title: Declaration diagnostics allocate a diagnostic selector closure for every declaration visited · Issue #64720 · microsoft/TypeScript · GitHub

Open Graph Title: Declaration diagnostics allocate a diagnostic selector closure for every declaration visited · Issue #64720 · microsoft/TypeScript

X Title: Declaration diagnostics allocate a diagnostic selector closure for every declaration visited · Issue #64720 · microsoft/TypeScript

Description: 🔎 Search Terms declaration emit performance, declaration diagnostics, allocations, setupDiagnosticContext, createGetSymbolAccessibilityDiagnosticForNode, noEmit declaration 🕗 Version & Regression Information Observed on main (7.1.0-dev, ...

Open Graph Description: 🔎 Search Terms declaration emit performance, declaration diagnostics, allocations, setupDiagnosticContext, createGetSymbolAccessibilityDiagnosticForNode, noEmit declaration 🕗 Version & Regression I...

X Description: 🔎 Search Terms declaration emit performance, declaration diagnostics, allocations, setupDiagnosticContext, createGetSymbolAccessibilityDiagnosticForNode, noEmit declaration 🕗 Version & Regressi...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/64720

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Declaration diagnostics allocate a diagnostic selector closure for every declaration visited","articleBody":"### 🔎 Search Terms\n\ndeclaration emit performance, declaration diagnostics, allocations, setupDiagnosticContext, createGetSymbolAccessibilityDiagnosticForNode, noEmit declaration\n\n### 🕗 Version & Regression Information\n\n- Observed on `main` (7.1.0-dev, aa8149273b, 2026-10-09).\n\n### ⏯ Playground Link\n\nNot reproducible in the playground; it needs a generated project. Generator below.\n\n### 💻 Code\n\n`node gen.mjs && tsgo -p . --extendedDiagnostics`\n\n```js\n// Ordinary files with many exported declarations, checked with `declaration: true` so that declaration\n// diagnostics run the declaration transformer over every declaration.\nimport fs from \"node:fs\";\nconst FILES = 1500, CLASSES_PER_FILE = 6;\nfs.mkdirSync(\"src\", { recursive: true });\nfor (let f = 0; f \u003c FILES; f++) {\n  let text = \"\";\n  for (let c = 0; c \u003c CLASSES_PER_FILE; c++) {\n    const n = `${f}_${c}`;\n    text += `export interface Options${n} { name: string; size?: number; tags: readonly string[] }\nexport class Service${n}\u003cT extends object = {}> {\n    private readonly items = new Map\u003cstring, T>();\n    static readonly kind = \"service${n}\" as const;\n    constructor(public readonly options: Options${n}, protected limit = 10) {}\n    get count() { return this.items.size; }\n    set count(value: number) { this.limit = value; }\n    add(key: string, item: T, overwrite = false) { if (overwrite || !this.items.has(key)) this.items.set(key, item); return this; }\n    find(predicate: (item: T, key: string) => boolean) { for (const [key, item] of this.items) if (predicate(item, key)) return { key, item }; return undefined; }\n    map\u003cU>(fn: (item: T) => U) { return [...this.items.values()].map(fn); }\n}\nexport function create${n}(options: Options${n}) { return new Service${n}(options); }\nexport const defaults${n} = { name: \"${n}\", size: ${c}, tags: [\"a\", \"b\"] as const };\nexport type Item${n} = ReturnType\u003ctypeof create${n}> extends Service${n}\u003cinfer T> ? T : never;\n`;\n  }\n  fs.writeFileSync(`src/file${f}.ts`, text);\n}\nfs.writeFileSync(\"tsconfig.json\", JSON.stringify({ compilerOptions: { target: \"es2022\", module: \"esnext\", moduleResolution: \"bundler\", strict: true, declaration: true, noEmit: true, types: [], lib: [\"es2022\"] }, include: [\"src\"] }));\n```\n\n### 🙁 Actual behavior\n\n14.5M allocations for a 1,557-file program with no errors.\n\nEvery declaration the declaration transformer visits installs a diagnostic context: `setupDiagnosticContext` calls `createGetSymbolAccessibilityDiagnosticForNode`, which allocates a closure that picks the message to report if a symbol used by the declaration turns out to be inaccessible. It also returns a second closure that restores the previous context. The selector is only invoked when such an error is actually reported, which almost never happens.\n\nThis runs for every emitted declaration file, and under `noEmit` with `declaration` enabled for every file's declaration diagnostics. In an 8.6k-file package of a private monorepo, the two closures were 11% of all allocations of a `--noEmit` check.\n\n### 🙂 Expected behavior\n\nEstablishing a diagnostic context should not allocate; the selector only needs to exist once an error is reported.\n\n### Additional information about the issue\n\nWith the change in the linked PR, the program above makes 8.7M allocations (−40%) and the monorepo check makes 11% fewer. Emitted declarations and diagnostics are unchanged.\n\nThe profiling and the patch were done with Claude Code.\n\n","author":{"url":"https://github.com/gwkline","@type":"Person","name":"gwkline"},"datePublished":"2026-10-10T09:00:31Z","url":"https://github.com/microsoft/TypeScript/issues/64720"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:bfed0fdd-5870-5c0a-8c7b-50dc7a881465
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDEB2:3F8AB1:1260F6C:177D2AE:6B010AD5
html-safe-nonced0cc15f6e4078b8904b32788770ef95f4ea9d3b068a273de03cc6ffaf06b3259
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERUIyOjNGOEFCMToxMjYwRjZDOjE3N0QyQUU6NkIwMTBBRDUiLCJ2aXNpdG9yX2lkIjoiNTk3Nzk1Mzk3Nzk0NDMxMjUzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf81c66845b6e7f1f97f76b349f988adfcae56803636a215c9d62559e51119112
hovercard-subject-tagissue:5789782994
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/64720/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bf8f7c4aa0bf485986a294a1853a93ed3a500778ea33e6d889cb56eeb3806689/microsoft/TypeScript/issues/64720
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bf8f7c4aa0bf485986a294a1853a93ed3a500778ea33e6d889cb56eeb3806689/microsoft/TypeScript/issues/64720
og:image:alt🔎 Search Terms declaration emit performance, declaration diagnostics, allocations, setupDiagnosticContext, createGetSymbolAccessibilityDiagnosticForNode, noEmit declaration 🕗 Version & Regression I...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegwkline
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/64720#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F64720
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%2Fissues%2F64720
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/64720
Reloadhttps://github.com/microsoft/TypeScript/issues/64720
Reloadhttps://github.com/microsoft/TypeScript/issues/64720
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests310 (310)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
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/64720
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/64720
Declaration diagnostics allocate a diagnostic selector closure for every declaration visitedhttps://github.com/microsoft/TypeScript/issues/64720#top
https://github.com/gwkline
Gavin Kline (gwkline)https://github.com/gwkline
on Oct 10, 2026https://github.com/microsoft/TypeScript/issues/64720#issue-5789782994
aa81492https://github.com/microsoft/TypeScript/commit/aa8149273b23401f0a79a5f0384c42de51888693
https://github.com/gwkline
Gavin Kline (gwkline)https://github.com/gwkline
on Oct 20, 2026https://github.com/microsoft/TypeScript/issues/64720#issuecomment-6295601315
#64723https://github.com/microsoft/TypeScript/pull/64723
Gavin Kline (gwkline)https://github.com/gwkline
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 20, 2026https://github.com/microsoft/TypeScript/issues/64720#event-33761507844
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/64720
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/64720
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

Viewport: width=device-width


URLs of crawlers that visited me.