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

One pager writeups #11045

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions documentation/specs/proposed/decoupling-vs-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Decoupling VS builds of .NET SDK projects
The experience of building a .NET SDK project can differ significantly depending if the project was built using Visla Studio / MSBuild or `dotnet build`. The build can produce different diagnostics, use different language rules, etc... and that is because building a .NET SDK project from Visual Studio mixes components from MSBuild and the .NET SDK. This means core tooling, like the compiler, can be substantially different between the two types of build. This leads to customer confusion and hard to diagnose problems, as well as increased code workload. To solve this want to ensure that when building a .NET SDK project we use the components from the .NET SDK to do so.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The experience of building a .NET SDK project can differ significantly depending if the project was built using Visla Studio / MSBuild or `dotnet build`. The build can produce different diagnostics, use different language rules, etc... and that is because building a .NET SDK project from Visual Studio mixes components from MSBuild and the .NET SDK. This means core tooling, like the compiler, can be substantially different between the two types of build. This leads to customer confusion and hard to diagnose problems, as well as increased code workload. To solve this want to ensure that when building a .NET SDK project we use the components from the .NET SDK to do so.
The experience of building a .NET SDK project can differ significantly depending if the project was built using Visual Studio / MSBuild or `dotnet build`. The build can produce different diagnostics, use different language rules, etc. This is because building a .NET SDK project from Visual Studio mixes components from Visual Studio and the .NET SDK. This means core tooling, like the compiler, can be substantially different between the two types of build. This leads to customer confusion and hard-to-diagnose problems. To solve this want to ensure that when building a .NET SDK project we use more components from the .NET SDK to do so.

I cut "code workload" because I don't think I know what it is.


## Goals and Motivation

We are aiming for:
- Consistent end-user eperience for build in either DotNet CLI or Visual Studio.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Consistent end-user eperience for build in either DotNet CLI or Visual Studio.
- More consistent end-user experience for build between .NET CLI and Visual Studio.

- Decoupling the .NET SDK experience from Visual Studio
- Decoupling the .NET SDK from VS.
Comment on lines +8 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do these differ?

Suggested change
- Decoupling the .NET SDK experience from Visual Studio
- Decoupling the .NET SDK from VS.
- Decoupling the .NET SDK experience from Visual Studio


The reason we are persuing this is for a better experience when using or writting Roslyn analyzers and MSBuild Tasks. Currently tooling authors need to target NetStandard2.0 for their projects to be recognized by VS. Another options is to multi-target but it takes a lot more effort and time spent on that. Another aspect is the user experience, if the Roslyn version for VS analyzers and generators doesn't match the one in Visual Studio, they do not work.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph seems to be combining what TFM analyzers need to target and SDK / VS analyzer tearing. Think we should split up those concerns.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Roslyn analyzers/generators targeting netstandard2 are one concern, multitargeting tasks is another, SDK tearing is a third.


## Impact
There are a few area of impact:
- .NET SDK style project builds will be more stable between VS and CLI builds, as the tooling will not be devided between different versions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- .NET SDK style project builds will be more stable between VS and CLI builds, as the tooling will not be devided between different versions.
- .NET SDK style project builds will be more stable between VS and CLI builds, as the tooling will be less divided between different versions.

(there will still be tearing on core targets for the medium term)

- Reduced cost of development for external and internal teams that contribute to Roslyn Analyzers, SourceBuild generators, or MSBuild Tasks.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Reduced cost of development for external and internal teams that contribute to Roslyn Analyzers, SourceBuild generators, or MSBuild Tasks.
- Reduced cost of development for external and internal teams that author Roslyn Analyzers, source generators, or MSBuild Tasks.

- End-user will not experience mismatch between analyzer versions, and confirmation that their .NET SDK style builds will behave the same way in VS and in the command line.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- End-user will not experience mismatch between analyzer versions, and confirmation that their .NET SDK style builds will behave the same way in VS and in the command line.
- End-user will not experience mismatch between analyzer versions, and gain higher confidence that their .NET SDK project builds will behave the same way in VS and in the command line.


## Stakeholders
For the internal stakeholder, we have the teams that will continue the work to fully complete the VS and .NET SDK decoupling feature after our base work is done. There are two handovers in this project:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For the internal stakeholder, we have the teams that will continue the work to fully complete the VS and .NET SDK decoupling feature after our base work is done. There are two handovers in this project:
Other teams will need to work to fully complete the VS and .NET SDK decoupling feature after our base work is done. There are two handovers in this project:


1. Enabling the MSBuild.exe execution state to be the same as DotNet command line invocation so the Roslyn team can enable the use of their core compiler in VS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Enabling the MSBuild.exe execution state to be the same as DotNet command line invocation so the Roslyn team can enable the use of their core compiler in VS.
1. After providing enough information to do so through MSBuild and the SDK, Roslyn will need to use it to invoke their .NET compiler in VS.

2. Tasks and other projects can be written in .NET Core and the .NET SDK projects will build successuflly in VS. This enables other teams to migrate their tasks to .NET Core instead of keeping them targeting .NET Framework.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Tasks and other projects can be written in .NET Core and the .NET SDK projects will build successuflly in VS. This enables other teams to migrate their tasks to .NET Core instead of keeping them targeting .NET Framework.
2. After MSBuild enables tasks to target .NET even for VS use, task-owning teams like the .NET SDK will need to migrate their targets to use .NET Core instead of keeping them targeting .NET Framework.


The handovers should allow other teams to proceed with their work smoothly and no change in build behaviour should be present within MSBuild.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The handovers should allow other teams to proceed with their work smoothly and no change in build behaviour should be present within MSBuild.
The handovers should allow other teams to proceed with their work smoothly and no unexpected change in build behavior should be present within MSBuild.


## Risks
A few risks associated with this feature:
- Our work is early in the development effort. If this feature is discovered to have too large of an impact in experience of performance the work might be delayed or discarded.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Our work is early in the development effort. If this feature is discovered to have too large of an impact in experience of performance the work might be delayed or discarded.
- If .NET Core tasks is discovered to have too large of a performance impact (due to IPC overhead to a .NET process), core partner teams may choose to keep multitargeting their tasks for improved user perf.

- There might be a performance hit on VS once we start running tasks on .NET Core. It would depending on the amount of non-framwork tasks that the project will need to load when opening it in VS. The performance gain from pre-loading will not be available in this scenario.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this different from the previous bullet?

- There are no concrete deadlines for our part of the feature, but we are aiming for an early preview cycle, so we have a chance to measure the consequences and fix any issues that arise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a concrete deadline: 17.14. Usually we support the .NET SDK in the previous VS (when targeting older .NET versions), so if we don't hit 17.14 we'll have to either change that policy at the SDK level or not adopt the new stuff in 10.0.


## Plan
1. Ensure that MSBuild.exe provides the same execution state as the dotnet command line invocation.
- This is should take around 1 dev week to complete, and will be handed over to Roslyn team.
maridematte marked this conversation as resolved.
Show resolved Hide resolved
2. Implement .NET Core task host, tasks can be executed on the .NET Core vresion instead of .NET framework.
- This should take 1 to 2 dev months to complete, including extensive testing. This would be handed over to internal teams that have custom tasks so they can be updated and tested.
3. Load common targets from the .NET SDK and not from .NET NetFramework on VS. This work depends on other team's finilizing their part of the feature and might not be in scope for .NET 10.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's any way this is in scope for 10 and would preemptively cut it.

- This should take a dev week, if there are no major bugs or regressions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my estimate is that this would take much, much longer than this--the code change is easy, the implications are hard to manage and so is the testing.


24 changes: 24 additions & 0 deletions documentation/specs/proposed/evaluation-perf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Evaluation performance investigations
In the current effort to improve performance of MSBuild, we ideantified the evaluation as one of the focus areas of this effort. Evalution is the ifrst step when building, and it determines references, how projects are connected and what needs to be build. Because of this it runs in every single build, be it Design-time builds in Visual Studio, up-to-date builds or full builds.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In the current effort to improve performance of MSBuild, we ideantified the evaluation as one of the focus areas of this effort. Evalution is the ifrst step when building, and it determines references, how projects are connected and what needs to be build. Because of this it runs in every single build, be it Design-time builds in Visual Studio, up-to-date builds or full builds.
In the current effort to improve performance of MSBuild, we identified evaluation as one of the focus areas of this effort. Evaluation is the first step when loading or building, and it determines references, how projects are connected and what needs to be build. Because of this it runs in every MSBuild scenario, from solution load and design-time builds in Visual Studio, to up-to-date builds or full builds in VS or on the command line.


## Description
Current performance state of evaluation is mostly unkown, as it is not measured in any ways by the team. As such, we are unsure which specific areas can be improve. The investigation about this is necessary so we can identify weaknesses, and possible fixes.
baronfel marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little harsh. I'd say it's not tracked or dashboarded, but it is measured in several ways.

The work here is to have a live report we can use to a) justify investment in eval perf and b) guide what that investment entails.


- We could do profiling
- Jit compilation of MSBuild itself.
- We could cache at eval

Constraint - needs to work as it does today, but fast. We can break some edge cases.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Constraint - needs to work as it does today, but fast. We can break some edge cases.
Constraint - needs to work as it does today, but faster. We may be able to break some edge cases.

(we can't, we can't break edge cases . . . but maybe!)


## Goals and Motivation
We are trying to make evaluation phase of the build more performant, since it is almost always executed any performance gain becomes noticeable. A performant evaluation phase would decrease build times in general, in CI cases it frees up resources, and in individual cases it can increase dev-loop performance by making up-to-date and incremental builds go faster.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this different from "description"? Maybe keep this here and change description to be "we want to track the data better"?


In this moment we are still in investigation phase, the obejective is to add code markers, so we can idetentify low hanging fixes, and improvement areas when testing builds within PerfStar.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markers are already there for the most part, is there something specific we're planning to add?


## Risks
One of the big risks is accidentally changing the current behaviour of evaluation. One of the constraints of improvement is that evaluation has the same behavior, with the exception of edge cases where we can sometimes change it.

## Plan
The plan for evaluation at the moment is to add more code markers during execution so we can use PerfStar to have a detailed view of how long each part of evaluation phase takes.

Larger changes to the evaluation are possible and under consideration for future iterations, like trying to cache the evaluation result in MSBuild. However we are focusing on investigation and performance gains with less work at the moment.
38 changes: 38 additions & 0 deletions documentation/specs/proposed/perfStar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# PerfStar
PerfStar is a performance tracking and investigation tool for MSBuild. PerfStar infrastructure captures performance measurements of main MSBuild branch on schedule and allows us to request experimental runs and collect performance of the new changes. The first version of this project is being finalized, with some fixes necessary to run it automatically and according to prerequisites.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PerfStar is a performance tracking and investigation tool for MSBuild. PerfStar infrastructure captures performance measurements of main MSBuild branch on schedule and allows us to request experimental runs and collect performance of the new changes. The first version of this project is being finalized, with some fixes necessary to run it automatically and according to prerequisites.
PerfStar is a performance tracking and investigation tool for MSBuild. PerfStar infrastructure captures performance measurements of the `main` MSBuild branch on a schedule and allows us to request experimental runs and collect performance data for proposed changes. The first version of this project is being finalized, with some fixes necessary to run it automatically and according to prerequisites.


## Goals and Motivation
MSBuild currently does not have a lot of performance data outside of Visual Studio performance tracking, which has a lot of variables that are beyond the team's control. PerfStar enables us to measure our performance without interference of elements that the team does not own. As such, we can measure the performance of in-development features and how it will impact build times, as well as have concrete numbers when working on performance improvement tasks.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MSBuild currently does not have a lot of performance data outside of Visual Studio performance tracking, which has a lot of variables that are beyond the team's control. PerfStar enables us to measure our performance without interference of elements that the team does not own. As such, we can measure the performance of in-development features and how it will impact build times, as well as have concrete numbers when working on performance improvement tasks.
MSBuild currently does not have a lot of performance data outside of Visual Studio performance tracking, which has a lot of variables that are beyond the team's control. PerfStar enables us to measure our performance with less interference of elements that the team does not own. As such, we can measure the performance of in-development features and how it will impact build times, as well as have concrete numbers when working on performance improvement tasks.


## Impact
Perfstar's impact is focused on the team. We will be able to track performance with concrete numbers. Because of that the team will be able to take more informed decisions about taking performance improvement work, as well as future and implementation of new features.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Perfstar's impact is focused on the team. We will be able to track performance with concrete numbers. Because of that the team will be able to take more informed decisions about taking performance improvement work, as well as future and implementation of new features.
Perfstar's impact is focused on the team. We will be able to track performance with concrete numbers. Because of that the team will be able to take more informed decisions about performance improvement work, as well as implementation of new features. In turn, those decisions will accrue value to users via higher build performance.


## Risks
The risks associated with our dependencies is about Crank, which is owned by the ASP.NET team and we use it to help us with machine setup to run the performance tests.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd extend this: PerfStar is a service, even if it's one primarily for our own use, and introduces a bunch of risks related to service maintenance.


## Plan
Investiment for .NET 10:
1. Making PerfStar execute automatically the way the design doc indicates
- Around 1 dev week.
2. The PowerBI reporting is working and updating the new information
- Around 2 dev weeks.
3. New performance tests for new features, and writting docs on how to write those tests. Next feature planned for tests: BuildCheck.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. New performance tests for new features, and writting docs on how to write those tests. Next feature planned for tests: BuildCheck.
3. New performance tests for new features, and writing docs on how to write those tests. Next feature planned for tests: BuildCheck.

- Around 3 dev days per feature.
4. Analyze stability of performance tests, and fix any noise found. This will be done through multiple iterations of the same test in the same machine, as well as updating the PowerBI report to handle the new data.
- Around 2 dev weeks.
5. Add more tests using `msbuild.exe` for build instead of `dotnet build`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
5. Add more tests using `msbuild.exe` for build instead of `dotnet build`.
5. Add more tests using `msbuild.exe` for build in addition to `dotnet build`.

- Around 1 dev week.
6. Timeboxed collection of feedback from our team, as well as performance investigations that can derive from those.
- 1 - 2 dev month depending on feedback and requests for improvement from the team.
7. Add more test cases. For example, build time with different verbosity levels.
- Around 1 dev week.

There are more improvements form PerfStar, but these are not established for .NET 10 yet as they depend on the team's feedback to PerfStar.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
There are more improvements form PerfStar, but these are not established for .NET 10 yet as they depend on the team's feedback to PerfStar.
There are more improvements form PerfStar, but these are not planned for .NET 10 as they depend on the team's feedback to PerfStar.

1. Add more measurements, like dotnet counter tool.
- Around 3 dev weeks.
2. Trace collection when specific features are turned on for the test.
- Around 2 - 3 dev weeks.
3. Report improvements:
- Compare performance numbers between two different iterations that are not from `main` branch. Around 2 dev weeks.
- Automatic detection of performance issues, so we don't need to check the reports to see regressions. Around 1 dev month.
- Run MSBuild API tests, so we can check performance of calls relating to Visual Studio builds. Around 1 dev month.