Skip to content

[wasm][coreclr] Precompress reusable runtime-pack assets - #137939

Open
radekdoulik wants to merge 7 commits into
dotnet:mainfrom
radekdoulik:radekdoulik-precompressed-runtime-pack
Open

radekdoulik wants to merge 7 commits into
dotnet:mainfrom
radekdoulik:radekdoulik-precompressed-runtime-pack

Conversation

@radekdoulik

@radekdoulik radekdoulik commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Precompress reusable CoreCLR browser-WASM assets in the runtime pack so Debug
builds can reuse the WebCIL, content hashes, and gzip bytes.

  • Ship gzip for prebuilt R2R images, facade WebCIL, native WASM, runtime JS/maps,
    and ICU. Record separate original and encoded hashes in PrecompressedAssets.xml.
  • Decode required native inputs and compatible assemblies into project intermediates.
    Keep source PEs, source-identity and format checks, and fallback conversion.
  • Pair the gzip files with their primary assets. The Static Web Assets SDK
    validates and copies the alternatives, defines endpoints, and negotiates
    compression. App assets and boot configuration keep their normal build paths.

The runtime and WebAssembly SDK packs must be updated together: older SDK packs
cannot consume gzip-only runtime files. Consumers reuse the hashes from the
restored pack rather than rehashing payloads each build.

Validation

Validated against main 1ae3885b4290 with SDK 12.0.100-alpha.1.26557.102
on macOS arm64, without restore or IP networking.

  • Shipping task rebuilds (net12.0 and net472) and Wasm test project rebuild:
    zero warnings or errors.
  • WebcilInWasmSizesTests: 57 passed, no failures or skips, 23 fixture binlogs.
    The hosted cases run the SDK compression targets and verify pack gzip reuse,
    normal app-asset compression, and per-client endpoints. The downgrade and
    DisableBuildCompression regressions pass.

Full pack composition, native/R2R rebuilds, browser and Windows runs, AOT, and
publish were not rerun. Signing/SignCheck for catalogued JS inside gzip still
needs Release Engineering confirmation.

Earlier integration measurement

On earlier revision 3e45eba, six paired Havit dotnet run captures gave a
median run-to-render of 8.752 s to 8.135 s (7.05% lower). The runtime nupkg
went from 66,853,952 to 66,991,473 bytes; the app used 187 of 192 packaged
representations. That run used native inputs 4db17d3, SDK
12.0.100-alpha.1.26480.102, app 996fd31, and Chrome 157.0.8103.40 on an
Apple M2 Max with warm caches. It predates the latest changes and was not rerun.

Note

Drafted with GitHub Copilot.

Ship gzip runtime representations and their content metadata, and reuse
them through the normal static-web-assets pipeline during app builds.

Co-authored-by: Copilot App <[email protected]>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@maraf maraf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe this should be a much smaller PR. There is a prior in StaticWebAssets SDK for shipping precompressed asset inside of a nuget package. We should learn from the approach to find out how to reuse most of the pieces.

radekdoulik and others added 5 commits November 23, 2026 11:49
Use the SDK materializer directly and exercise its normal build compression pipeline in the hosted fixture. Filter eligible WebCIL representations before candidate selection.

Co-authored-by: Copilot App <[email protected]>
Distinguish empty and populated selection stamps, and normalize the fixture temp path before comparing SDK asset identities.

Co-authored-by: Copilot App <[email protected]>
@radekdoulik

Copy link
Copy Markdown
Member Author

@maraf, on SDK reuse: I removed the extra DefineStaticWebAssets pass. The gzip alternatives go straight to the SDK materializer, and the hosted tests now exercise the SDK compression targets.

Discovery expects a .gz sibling, but our gzip files are in the pack and their primaries are in obj. To drop the adapter, the SDK would need explicit primary-to-gzip pairs, precomputed fingerprints and integrity, and copy names keyed by the gzip fingerprint. Runtime would still select and decode the pack inputs.

Note

Drafted with GitHub Copilot.

@maraf maraf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving to get the branchmark numbers soon with a refactoring in a follow-up

Use raw or manifest-listed gzip pack entries in native, ICU, symbol-map, and ReadyToRun assertions. Keep the existing size comparisons and cover both pack layouts.

Co-authored-by: Copilot App <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants