[http-client-csharp] Skip unnecessary simplifier passes#10846
Draft
live1206 wants to merge 14 commits into
Draft
[http-client-csharp] Skip unnecessary simplifier passes#10846live1206 wants to merge 14 commits into
live1206 wants to merge 14 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
commit: |
Contributor
|
No changes needing a change description found. |
Run simplification for documents containing global aliases so shared-source type names and generated sample code are reduced correctly while still skipping documents that do not need simplification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Generate valid assignment statements without relying on Roslyn simplification, and keep shared-source test expectations aligned with the skip behavior so broad global-alias simplification is not reintroduced. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refresh generated test projects and unit test expectations after skipping Roslyn simplification for documents without simplifier annotations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid emitting a trailing space after array type syntax when the initializer is multiline. Regenerated outputs now match without manual generated-file whitespace edits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use plain default for known cancellation token optional parameters so generated code remains valid when documents are not passed through Roslyn simplification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refresh remaining generator unit test baselines after removing trailing spaces from multiline array initializers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This reverts commit 6aa5e5a.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Avoid running Roslyn
Simplifier.ReduceAsyncfor generated documents that do not containSimplifier.Annotation.Previously, every generated document root was annotated with
Simplifier.Annotation, which forced a full-document simplifier pass across all generated files. This removes the blanket root annotation and keeps the simplifier pass only for documents that still have targeted simplifier annotations after member removal and library rewriters.Motivation
While profiling Azure.ResourceManager.Network generation through the Azure management generator, Roslyn post-processing dominated the direct .NET generator run time. The hotspot was
Simplifier.ReduceAsyncin the shared MTGGeneratedCodeWorkspace.ProcessDocumentpath.Latest Network measurements as of 2026-06-02:
Manual end-to-end Network regeneration
00:11:20.2700:08:19.39~3m00.88The current TypeSpec/MTG Network regen is still about 3 minutes slower than AutoRest.CSharp, so this PR improves the main measured MTG hotspot but does not eliminate the full regen gap.
Direct .NET generator phase isolation
Simplifier.AnnotationThe fresh current-branch direct-generator rerun produced 3,542 generated files, including 1,192
.Serialization.csfiles. Roslyn post-processing was still ~96% of the isolated direct-generator time, confirming this remains the dominant hotspot even after the skip. The latest rerun improved the direct generator from the previous ~8m26s measurement to ~8m13s.Notes
Simplifier.Annotationstill go throughSimplifier.ReduceAsync.Validation
cd packages/http-client-csharp pwsh ./eng/scripts/Generate.ps1 npm run test:generatorTargeted Spector coverage checks for the previously failing cases also passed locally: