[dotnet-watch] Improve startup time
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
A couple of optimizations we can implement:
1) Remove design-time build from the startup path. We run `dotnet build` and then we run in-proc design-time build to get pretty much the same information that already exists within `dotnet build`. The build could save it to a file in obj dir that we read. The same applies not just watch but also to IDEs (VS and CDK).
2) VBCSCompiler server that runs during `dotnet build` has all source files parsed and all metadata references loaded and decoded. Loading the baseline Roslyn Solution in watch needs exactly the same artifacts, which need to be recreated. Instead, the server could create `HotReloadWorkspace` upon request from `dotnet watch` and keep it up-to-date based on information sent to it from `dotnet watch` as files change on disk. This workspace would be disposed of when `dotnet watch` terminates. It might even be possible to seed the workspace with the project compilations created during the build, as those are exactly the compilations we need to use as a baseline for Hot Reload.
The EnC service in IDE (VS/CDK) would also benefit from fetching baseline source file snapshots loaded in VBCSCompiler for recent build. See https://github.com/dotnet/roslyn/blob/a1696ddfa684b7044ba4429e1c9c1171e698b63c/src/Features/Core/Portable/EditAndContinue/CommittedSolution.cs#L347
Related: https://github.com/orgs/dotnet/projects/618/views/2?pane=issue&itemId=143278174
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the dotnet-watch startup flow and the linked Roslyn CommittedSolution.cs reference, then trace how dotnet build and VBCSCompiler currently provide information to Hot Reload. Done means the proposed design removes redundant startup work and defines how the workspace and baseline artifacts remain current, but the issue does not name implementation files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, cli, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100