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

[browser] Allow downloading WebAssembly resources without performing other WebAssembly runtime initalization #102254

Merged
merged 7 commits into from
Jun 7, 2024

Conversation

pavelsavara
Copy link
Member

Fixes #100299

import { dotnet } from './_framework/dotnet.js'

// optional call to download all assets
await dotnet.download();

// and later it could be followed by usual
const runtime = await dotnet.create();

Note that when we download assets during cold start, they are being loaded into WASM memory as they arrive.
When you already have pre-downloaded the assets with this new API, the startup of the runtime will be more of the burst. Similar as with assets already in a cache.

@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm labels May 15, 2024
@pavelsavara pavelsavara added this to the 9.0.0 milestone May 15, 2024
@pavelsavara pavelsavara self-assigned this May 15, 2024
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

@maraf
Copy link
Member

maraf commented May 16, 2024

Please add a WBT. Since we will remove custom cache shortly, we can check that all URLs that are used during "download" phase will be used during real start phase.

@pavelsavara
Copy link
Member Author

Please add a WBT. Since we will remove custom cache shortly, we can check that all URLs that are used during "download" phase will be used during real start phase.

I'm not sure that I follow. What would the test look like ?

@maraf
Copy link
Member

maraf commented May 20, 2024

I'm not sure that I follow. What would the test look like ?

What I'm thinking about for the test is that we can ensure that no new resource will be requested during real start after download() was called. So the idea is to install resourceLoader (or override fetch), record all URLs used during download() and verify that no new URLs were requested during create()

@ilonatommy ilonatommy self-requested a review as a code owner June 5, 2024 13:58
@ilonatommy ilonatommy merged commit 8fac5af into dotnet:main Jun 7, 2024
33 of 36 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 7, 2024
@pavelsavara pavelsavara deleted the browser_download_only_api branch September 2, 2024 15:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[browser] Allow downloading WebAssembly resources without performing other WebAssembly runtime initalization
3 participants