Skip to content

Migrate ApplyCompressionNegotiation to IMultiThreadableTask - #54703

Merged
jankratochvilcz merged 1 commit into
dotnet:mainfrom
jankratochvilcz:mt/migrate-apply-compression-negotiation
Jun 12, 2026
Merged

jankratochvilcz merged 1 commit into
dotnet:mainfrom
jankratochvilcz:mt/migrate-apply-compression-negotiation

Conversation

@jankratochvilcz

@jankratochvilcz jankratochvilcz commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Migrates ApplyCompressionNegotiation (src/StaticWebAssetsSdk/Tasks/ApplyCompressionNegotiation.cs) to multi-threadable by adding [MSBuildMultiThreadableTask].

Fixes dotnet/msbuild#14031

Perfstar regression (14d, Windows, paired MT vs non-MT, p50 sum across iterations)

Target non-MT (ms) MT (ms) Δ (ms) Δ (%)
ResolveBuildCompressedStaticWebAssets 325 6,423 +6,098 +1,876 %

Changes

  • [MSBuildMultiThreadableTask] on the concrete class. No IMultiThreadableTask plumbing needed — the task body has no filesystem / environment / process I/O (pure metadata propagation and string composition).

Compatibility sins audit (per migration skill)

24/24 dimensions clean — attribute-only opt-in. No Path.* / File.* / Directory.* / Environment.* / Process.* calls; no [Output] AbsolutePath leakage; no new null-coalescing; no try/catch reorg; no dictionary keys requiring canonicalization; no exception-type divergence.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@jankratochvilcz

Copy link
Copy Markdown
Contributor Author

No decoy-style unit test added — not viable here

This is an attribute-only opt-in. A decoy-CWD test of the form used for GenerateStaticWebAssetsManifest / MergeConfigurationProperties is not meaningful: the task body contains no File.*, Directory.*, Path.GetFullPath, Environment.* (except Environment.NewLine, a string constant), or Process.* calls whose behavior could diverge under a different process CWD. There is therefore no observable runtime behavior the migration could regress for the decoy test to catch — the attribute purely toggles whether MSBuild wraps the task in a TaskHost, which a unit test cannot exercise.

@jankratochvilcz
jankratochvilcz marked this pull request as ready for review June 11, 2026 12:06
Copilot AI review requested due to automatic review settings June 11, 2026 12:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR annotates ApplyCompressionNegotiation as an MSBuild multi-threadable task by adding [MSBuildMultiThreadableTask], with the goal of enabling MSBuild to schedule it concurrently and improve build performance in static web assets compression negotiation.

Changes:

  • Add [MSBuildMultiThreadableTask] to ApplyCompressionNegotiation.

Comment thread src/StaticWebAssetsSdk/Tasks/ApplyCompressionNegotiation.cs
namespace Microsoft.AspNetCore.StaticWebAssets.Tasks;

[MSBuildMultiThreadableTask]
public class ApplyCompressionNegotiation : Task

@OvesN OvesN left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will be ok after we merge #54708

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ToAssetDictionary->fromTaskItem->normalize->getFullPath

Marks the task with [MSBuildMultiThreadableTask] so MSBuild's multithreaded mode skips the per-task TaskHost wrapper. The task body has no filesystem / environment / process I/O, so attribute-only opt-in is sufficient per the migration skill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jankratochvilcz
jankratochvilcz force-pushed the mt/migrate-apply-compression-negotiation branch from 101b8f9 to f145082 Compare June 12, 2026 16:11
@jankratochvilcz
jankratochvilcz enabled auto-merge (squash) June 12, 2026 16:23
@jankratochvilcz
jankratochvilcz merged commit 5e1a9ca into dotnet:main Jun 12, 2026
25 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 13, 2026
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

Successfully merging this pull request may close these issues.

[Multithreaded] Migrate ApplyCompressionNegotiation in SDK

3 participants