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

feat(wasm): use instantiateStreaming as much as possible #1900

Closed
wants to merge 2 commits into from

Conversation

lbwa
Copy link
Contributor

@lbwa lbwa commented Jan 1, 2022

This PR aims to optimize esbuild-wasm loading process.

Changes

  1. load wasm file in main worker thread
    • absolute path is required for resource fetching in worker thread. PR has covered scenario that wasmURL is a related path.
    • correct mime header is required. Otherwise, fallback to instantiate API.
  2. handle wasm loading errors and push them back to the main thread.
  3. only use WebAssembly.instantiate to instantiate wasm code. use WebAssembly.instantiateStreaming API by default. It will use WebAssembly.instantiate again if current browser doesn't support instantiateStreaming.

@lbwa
Copy link
Contributor Author

lbwa commented Jan 7, 2022

Reference to #1036 (comment)

@evanw evanw closed this in ed5e2c3 Dec 4, 2022
@lbwa lbwa deleted the wasm_stream branch December 4, 2022 16:55
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.

None yet

1 participant