WebAssembly / interface-types

Other
641 stars 57 forks source link

IndexedDb and XHR #16

Closed artem-v-shamsutdinov closed 5 years ago

artem-v-shamsutdinov commented 5 years ago

Hello,

Thank you for the work on this proposal! I'm very much looking forward to it's implementation (it is my understanding that this will make browser I/O much faster).

I have a few of questions:

Will support for IndexedDb be included? Will support for XHR (or it's modern incarnation) be included? What is the status of this proposal (there haven't been any activity on the repository for almost a year)?

Again, thank you very much for your time and effort!

lukewagner commented 5 years ago

Will support for IndexedDb be included?

No; this was considered for a while and removed. Multiple browsers are working on implicit caching of wasm machine code based on the HTTP cache.

Will support for XHR (or it's modern incarnation) be included?

You can XHR to get an ArrayBuffer and WebAssembly.instantiate(buffer) today. For a more modern and efficient incantation, you can WebAssembly.instantiateStreaming(fetch(url)), although not all browsers support yet.

What is the status of this proposal (there haven't been any activity on the repository for almost a year)?

After the reference types proposal was factored out, we've been actively working on that proposal. The main remaining problems to be solved in the Host Bindings proposal, once we have reference types, all concern removing the remaining cases where we unnecessarily need JS wrapper glue, allowing wasm to:

There's a lot more potential optimizations, but I imagine something like the above forming a "Host Bindings MVP". We should be discussing this at TPAC (or before) and updating the Proposal.md appropriately after that.

Pauan commented 5 years ago

@lukewagner To be clear, they're not talking about caching the WebAssembly instance/module, they're talking about using the IndexedDB API inside of a program which has been compiled to wasm.

Right now this requires wasm to import some JS shims, and then the JS shims use the IndexedDB API, but the host bindings proposal would allow wasm to call the IndexedDB APIs directly.

lukewagner commented 5 years ago

Ah, gotcha. Yes, then for that purpose you'd want reference types and the ability to call a method.

artem-v-shamsutdinov commented 5 years ago

Understood. Thank you very much for your time in answering these questions.