Live data from Hacker News

WebAssembly Playground

observablehq.com

91–99 of 99 posts

Re: WebAssembly Playground

#91

Question from someone knew very little in this domain: what stops mass adoption of WebAssembly? A few years ago, I used a WASM demo website which can use a WASM version of ffmpeg to mux audio and video into a file (transcoding obviously wasn't practical, at least not at that time), and I was very impressed. I can see lots of potential of it. But I still haven't see much usage of it even today. (To be totally honest -…

From my perspective It's 2 primary blockers. 1. It's too damn hard to get data into and out of wasm modules. The component model is addressing this but it's sprawled out into literally rebuilding "worlds" and turning wasm modules into sort of lightweight virtual machines. I wish there was just more of a focus on getting data into and out of modules first. 2. Lack of GC which has made languages like js/python/jvm/c# u…

> Lack of GC which has made languages like js/python/jvm/c# unfeasible.

If they weren't feasible, there wouldn't be several implementations shipping for several years now.

Just like a typical hardware CPU that isn't a *Language XYZ Machine", GC implementation ships with the runtime.

Re: WebAssembly Playground

#92

Question from someone knew very little in this domain: what stops mass adoption of WebAssembly? A few years ago, I used a WASM demo website which can use a WASM version of ffmpeg to mux audio and video into a file (transcoding obviously wasn't practical, at least not at that time), and I was very impressed. I can see lots of potential of it. But I still haven't see much usage of it even today. (To be totally honest -…

Some things that might greatly increase wasm usage and overall tooling:

1) Tools that run docker containers and serverless function services (like AWS lambda) to support providing a .wasm files instead

2) Garbage collection in the runtime to make GC languages easier to port to wasm

3) Dynamically typed languages (NodeJS, Python, Ruby) being able to compile to webassembly directly instead of porting the runtime to webassembly and then running the code through the runtime. This is a big ask though, basically needs to redesign the runtime completely

4) wasm-DOM bindings will enable other languages to do HTML rendering which will require new web frameworks for every language that wants to take over the space from JS. This will lead to (even more) fragmentation of the web ecosystem

5) A new wasm-first SDK (unrelated to the DOM) for building cross platform applications. I can see this taking off only if it is built-into the browsers and backed by some standards committee, so not very likely I think

6) Something like the Interface Types proposal ( https://github.com/WebAssembly/interface-types/blob/main/pro... ) becomes a thing allowing wasm programs to be consisted of modules written in several different languages and being able to call said modules with low or 0 runtime performance hit (and of course, no compilation to multiple CPU archs). So much of programming ecosystems are locked to specific languages (like data science with python) when there is little technical reason for it be like that.

Re: WebAssembly Playground

#93
In my job we are using duckdb compiled to wasm in our browser-based application. We store time series data in it and can query the data to show charts and logs using SQL.

We insert the data into the database as we collect it, then we query the database for showing charts with the query parameters (time-range, parameters to plot, etc) based on the UI controllers. We also use its built-in parquet export functionality. It works great.

Re: WebAssembly Playground

#94

Earlier quoted context omitted.

From my perspective It's 2 primary blockers. 1. It's too damn hard to get data into and out of wasm modules. The component model is addressing this but it's sprawled out into literally rebuilding "worlds" and turning wasm modules into sort of lightweight virtual machines. I wish there was just more of a focus on getting data into and out of modules first. 2. Lack of GC which has made languages like js/python/jvm/c# u…

Sadly the current iteration of WASM GC is still too limited for stuff like JVM or C# garbage collection semantics without jumping through a lot of hoops. I'm optimistic that in a few years there will be an expanded version of it that more runtimes can adopt, though. #1 is a pet grievance of mine though. The intentional choice not to build mmap or read-only pages into the WASM memory model is really frustrating.

I've been wondering how WASM GC works with multiple wasm modules, it sounds like you might know. Does WASM GC exist outside individual modules managing memory for many, or is it "contained" inside each module? Does it allow for efficient sharing and minimal copies of memory between modules when host calls both?

For example say you have some data like (eg. string "abc123") in host memory and then pass into module A which then reads/operates the data, and then returns some other data to the host. The host then calls into module B passing the original host data and data returned from call to module A. Can that original host data be shared efficiently and managed by WASM GC between modules?

Re: WebAssembly Playground

#95

Earlier quoted context omitted.

Sadly the current iteration of WASM GC is still too limited for stuff like JVM or C# garbage collection semantics without jumping through a lot of hoops. I'm optimistic that in a few years there will be an expanded version of it that more runtimes can adopt, though. #1 is a pet grievance of mine though. The intentional choice not to build mmap or read-only pages into the WASM memory model is really frustrating.

I've been wondering how WASM GC works with multiple wasm modules, it sounds like you might know. Does WASM GC exist outside individual modules managing memory for many, or is it "contained" inside each module? Does it allow for efficient sharing and minimal copies of memory between modules when host calls both? For example say you have some data like (eg. string "abc123") in host memory and then pass into module A wh…

I'm not aware of any reason why what you're describing wouldn't work. At least in a browser tab, all the wasm modules will share the same JavaScript GC heap, so the string data should be sharable between the modules if it's passed around as a GC reference.

Re: WebAssembly Playground

#96

Question from someone knew very little in this domain: what stops mass adoption of WebAssembly? A few years ago, I used a WASM demo website which can use a WASM version of ffmpeg to mux audio and video into a file (transcoding obviously wasn't practical, at least not at that time), and I was very impressed. I can see lots of potential of it. But I still haven't see much usage of it even today. (To be totally honest -…

From my perspective It's 2 primary blockers. 1. It's too damn hard to get data into and out of wasm modules. The component model is addressing this but it's sprawled out into literally rebuilding "worlds" and turning wasm modules into sort of lightweight virtual machines. I wish there was just more of a focus on getting data into and out of modules first. 2. Lack of GC which has made languages like js/python/jvm/c# u…

For #1, check out https://extism.org/

Re: WebAssembly Playground

#97
post #73

Earlier quoted context omitted.

> The component model is addressing this but it's sprawled out into literally rebuilding "worlds" and turning wasm modules into sort of lightweight virtual machines. I wish there was just more of a focus on getting data into and out of modules first. As someone who works on the Component Model, this perception is interesting to me, can you explain your thinking a bit more? From my perspective, getting data in and out…

As someone who wanted to try to use WASM ~1yr ago, I was unable to find any reasonable way to get data in/out of wasm from the local environment, and gave up on trying to learn it because of this. Could you please provide links/info for how to do so? I want to be able to learn how to use it, but without this ability it seems entirely useless for me.

Yep, this is one of the initial motivations for creating Extism: https://github.com/extism/extism -- and it works across 16 host languages & 8 guest languages.

Re: WebAssembly Playground

#98

Earlier quoted context omitted.

As far as I know Figma used asm.js (then WASM) from the start. I actually don't think they'd have had the success they had without it - it would have been too slow built in JS. So in a way webasm/asm.js is already allowing whole new categories of webapps we take for granted now.

I always wonder how much faster JS could be if the effort that went into WASM went into JS. ASM.js, SIMD, snapshots, etc directly in JS could have really made it a serious contender for high-performance software. Of course, without WASM, we'd be missing out on lots of cool software that was previously stuck on desktop/native. But I'm not entirely convinced it was the right path.

> Of course, without WASM, we'd be missing out on lots of cool software that was previously stuck on desktop/native.

Maybe not. Someone could have written a backend for GCC and/or LLVM that targets JS in the same way that Emscripten targets WASM (with JS around the edges).

Re: WebAssembly Playground

#99
Very cool -- if anyone else is curious about the WebAssembly code that powers this app, here are some pre-analyzed modules from the page:

337.35kB, 5 imports, 29 exports https://modsurfer.dylibso.com/module?hash=2c72ee42bd9430029d...

29.77MB, 27 imports, 1215 exports (!) https://modsurfer.dylibso.com/module?hash=2a466f0e990329d323...

18.59MB, 25 imports, 1 export https://modsurfer.dylibso.com/module?hash=36419ed20201176522...

Post reply on HN