Background & Problem
When investigating a customer reported issue of C# completion behaving slowly I started to peel the onion as to what was going on. Turns out source generators were taking up a significant portion of time which in-turn block language features like completion:

After profiling the issue and digging through Roslyn's source generator runners I found that source generator calculations were consuming nearly 93% of the time for completion:

Digging into some specific generators I also found that Razor's incremental source generator was also taking up roughly 53% of the time:

Solution
Given source generators are a public extension point now and many of them will be written in days to come we need to ensure our language features continue to work even in the presence of slower generators. @sharwell had some ideas about the language feature performance interaction in this area and proposed:
- We'd have a "frozen partial compilation" which would have partial frozen semantics avoid source generator execution. It'd assume the last known SG output is still the correct one to prevent us from re-running the SG aggressively. Consider the case of an analyzer that takes 20 seconds to run: for the first 20 seconds, APIs defined by source generators would not appear in high-profile features like completion. After that we'd update models for generators every 20s (assuming they can run fast enough).
Background & Problem
When investigating a customer reported issue of C# completion behaving slowly I started to peel the onion as to what was going on. Turns out source generators were taking up a significant portion of time which in-turn block language features like completion:
After profiling the issue and digging through Roslyn's source generator runners I found that source generator calculations were consuming nearly 93% of the time for completion:

Digging into some specific generators I also found that Razor's incremental source generator was also taking up roughly 53% of the time:

Solution
Given source generators are a public extension point now and many of them will be written in days to come we need to ensure our language features continue to work even in the presence of slower generators. @sharwell had some ideas about the language feature performance interaction in this area and proposed: