Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type providers get created hundreds of times causing large LOH allocations and UI delays inside VS #5929

Closed
davkean opened this issue Nov 20, 2018 · 3 comments
Milestone

Comments

@davkean
Copy link
Member

davkean commented Nov 20, 2018

Trace: https://developercommunity.visualstudio.com/content/problem/379653/vs-slow-typing-and-hang-1.html.

GC Rollup By Generation

Gen Count MaxPause MaxPeak MB Max AllocMB/sec TotalPause TotalAlloc MB Alloc MB/MSec GC Survived MB/MSec GC MeanPause Induced
ALL 305 13,100.2 2,515.3 9,389.575 23,078.5 2,845.1 0.1 13.147 75.7 1
0 187 20.6 2,481.5 4,736.269 1,031.3 1,109.3 0.4 0.050 5.5 0
1 108 13,100.2 2,509.7 9,389.575 14,950.0 1,486.1 5.3 0.199 138.4 0
2 10 728.8 2,515.3 14.396 7,097.2 249.7 2.5 20,674.062 709.7 1

In this trace, we're seeing large percentage of time spent collecting generations 1 & 2. If we dig into it, we can see that the majority of Gen2 collections are due to us creating hundreds of the same type providers over and over again, and they themselves allocating around 800KB each time. This results in about ~1.5 GB allocations all ending up on the LOH.

image

I would verify if we actually need to create type providers over and over again, and if not, introduce a cache based on the inputs so that we avoid this.

@davkean
Copy link
Member Author

davkean commented Nov 20, 2018

In total, this type provider path is allocating 2GB of data:

image

@davkean
Copy link
Member Author

davkean commented Nov 20, 2018

Note, I've filed #5931 to track the assembly metadata that the type providers themselves are loading.

@cartermp
Copy link
Contributor

Closing this out as a fix by @TIHan and a follow-up by @dsyme address this in the type provider SDK. There is a deeper artchitectural flaw where documents are typechecked a lot more than they need to, but the Type Provider part of that can be considered resolved.

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

No branches or pull requests

2 participants