Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As a complete layman in WebAssembly I always struggled to understand what are the use cases. I think what I don't understand is what the _Web_ part exactly means, is a browse thing? Or could be used to more general use cases?


Webassembly is a language-agnostic, non-proprietary bytecode, intended both to be used online and natively.

Like Flash, Silverlight and Java, it allows the embedding and running of binary applications in the browser (although currently this also requires a Javascript shim to allow access to the DOM.) Unlike those, however, Webassembly is not intended to be used only by a single language. You can compile C, C++, Rust, and many other languages to Webassembly and run them both in the browser and as native applications.


Web "means" it's portable and sandboxed, so theoretically you can run untrusted from the web and it only has access to what you expose.

This stacks with DOM sandboxed APIs so you get same level of isolation in the browser as JS but better perf and a memory model more suitable to other languages.

Outside of browser you still get sandboxed low level VM suitable for running C and other low level languages. Eg. you could compile a C module for say node and ship it compiled as WASM


"Web" means that WebAssembly was originally designed for web browsers.

That's a high bar. It needs to be portable to everywhere web browsers run, and it needs to be sandboxed so that it's safe to run downloaded code.

WebAssembly is now widely used outside of web browsers as well. The article linked here is not about web browsers; Lunatic runs on a server.


WebAssmebly is not web specific. And it's not assembly.

I think the best way to think of it is that "WebAssembly" is a great marketing name, but what it does is be a modern-day JVM: a byte code language that can run anywhere.


WebAssembly is a game changer. Why? Because it removes the need for JS, and is more performant. Couple that with a secure sand box to run your apps and you have a new distribution model, somewhere between a full native app and a completely online web app.

You have also removed the shackles of JS and provided an environment to which you can compile and you get the ability to port a lot of libraries and code to the new platform. How does this help? One, you can use other languages to write apps for the web. Two, you can use existing libraries to help develop your app. Three, by having a permission system to access system resources in a secure way, you can incorporate native application features and performance into your web app. Think about stuff like direct printer access, USB access, etc.


Now can we have the non-hyped up version?

As someone who doesn't mind the "shackles" of JS, from what I have seen so far, apps written in WebAssembly are up to two times slower than their JS counterparts. DOM access is abysmal, and from what I've seen in the wild, no one has written a serious business critical application using it yet.

What does webassembly do today, and what experience does it provide over javascript? I get the sandbox and distribution, but again, those advantages mostly apply to JS as well.


> from what I've seen in the wild, no one has written a serious business critical application using it yet.

There are lots of such applications, including:

* Figma

* Unity games on the Web

* Google Earth

* AutoCAD

* Aside from entire applications, crucial features in things like Zoom and Google Meet (filters, backgrounds, etc.).

WebAssembly won't replace JavaScript - it's for different things. Wasm lets you port native code to the Web, and it lets that type of code run very fast. That's even without SIMD and multithreading - with those things, wasm is even faster.


I rewrote the core part in C, invoked one command line operation, and now I can call the C like it was JS and the core part is 10x faster.

I'm not even a JS dev but it is certainly literally mind-blowing once you see it.


you can crosscompile from other languages to wasm. so you could have a codebase written in C for example, you crosscompile + bind to a minimal JS part. now your app works in a browser.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: