Stream: wasm

Topic: Browser Caching


view this post on Zulip Arne Vogel (Mar 02 2023 at 12:44):

Caching of compiled modules into IndexedDB was deprecated [1] [2]. There is a blog post on the v8 blog about caching [3] posted after the IndexedDB caching was deprecated. Is the information in the post still up to date? I am asking because I can't replicate the tracing with chrome://tracing; I am not seeing the caching-related function calls in the tracing.
Otherwise, is there some caching of compiled modules in firefox or other browsers?

[1] https://github.com/WebAssembly/spec/issues/821
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1469395
[3] https://v8.dev/blog/wasm-code-caching

We discussed this in the June 12th CG meeting. IndexedDB serialization of WebAssembly modules is implemented in some browsers, but not all, and code caching is currently only implemented in Firefox...

view this post on Zulip bjorn3 (Mar 02 2023 at 14:25):

Did you use compileStreaming or instantiateStreaming?

view this post on Zulip Arne Vogel (Mar 02 2023 at 14:40):

I tried both (the live demos from [1] and [2])

I also see compileStreaming and instantiateStreaming in the trace:
image.png

[1] https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/compileStreaming#compile_streaming
[2] https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/instantiateStreaming#instantiating_streaming

The WebAssembly.compileStreaming() function compiles a WebAssembly.Module directly from a streamed underlying source. This function is useful if it is necessary to a compile a module before it can be instantiated (otherwise, the WebAssembly.instantiateStreaming() function should be used).
The WebAssembly.instantiateStreaming() function compiles and instantiates a WebAssembly module directly from a streamed underlying source. This is the most efficient, optimized way to load wasm code.

Last updated: Nov 22 2024 at 16:03 UTC