1. 27

I see a lot of value in webassembly. I am wondering why it is not more popular. In particular does anyone use a lisp to wasm compiler in production?


  2. 30

    Right now it’s stuck in that annoying area of infancy where it’s utterly useless unless you spend a lot of time fitting square pegs into round holes. See my talk on this.

    1. 10

      Probably because wasm adds incremental benefit that’s only really worth it in special and relatively-unique circumstances, e.g. web-based 3d game engines. Otherwise the incremental benefit doesn’t really outweigh the costs.

      Web developers are happy with javascript, backend developers are happy with their existing runtimes.

      1. 3

        I was thinking about another potentially good fit for WASM, which is not front or back end. Web-based “native”-like apps. Web-based native apps are often RAM-hungry and unresponsive if too heavy on JavaScript. WASM can be a pretty good solution here. Having snappy desktop apps without sacrificing dev productivity nor performance.

        1. 5

          If it’s a desktop app, why wouldn’t you just use native code with an existing desktop app platform to directly address those performance issues? What advantage does wasm give you in that case?

          1. 5

            I can see it becoming a decent JVM competitor.

            1. 5

              What advantage does wasm give you in that case?

              It would be a web app, biggest advantage is instant update to latest version for everyone.

            2. 4

              Presumably cross-platform utility. Like Electron, but faster.

              1. 4

                The problem with Electron is mostly not the speed of JavaScript, though. It’s mostly the RAM usage of bundling in most of a web browser as runtime for every app. Just switching to WASM doesn’t do anything to solve that part; you also need a lighter cross-platform GUI framework.

                1. 3

                  Thanks for the clarification - I’m not intimately familiar with how Electron works “under the hood”.

                  1. 1

                    Would the inefficiency of Atom with larger files (not big in terms of storage space but big enough to make Atom crawl)—not as big of an issue with VS Code, in my experience—be at all helped by using WASM? That seems like it should be a case for needing a faster language, but I’m not sure.

                2. 1

                  From a corporate IT perspective:

                  With a web app you have a better upgrade story. You don’t have a bunch of different versions floating around in the world that you have to support. When you upgrade the site, everyone gets that site. Similarly, when you need to rollback, you just rollback. Nobody needs to know or care.

                  edit Well, should have kept reading. Marius said what I said, but more concisely.

            3. 10

              Because it’s less than two years old and tools to use it effectively take time to build.

              1. 4

                WASM is an enabler of new functionality, not a replacement of anything that has already been mainstream.

                For example, image optimization used to be too computationally demanding to do outside of native apps. With asm.js it was still too fiddly to do. But now there’s https://squoosh.app which bundles a bunch of fairly complex C and Rust libraries, and it all works at near-native speeds in the browser.

                1. 3

                  On the backend, how wasm virtual machine will compete with C nginx? Or it is suppose to compete with django and RoR?

                  1. 2

                    My question was more about browser-based wasm. Other answers are interesting tho.

                  2. 3

                    I did some wasm “hello world” stuff over the weekend. The toolchain is still pretty painful.

                    1. 2

                      I’d actually have to look up how to make something with WebAssembly. With JS, I can dump the source code into an HTML document and load the document. I can include a minified JS source code file into a document if I want to do something fancier. The basic workflow is very familiar to anyone who’s ever touched Web development at any time in the past couple decades.

                      With WebAssembly, there’s a compiler toolchain and bytecode and I probably can’t just dump the bytecode into HTML, can I? I probably have to engineer something to load the bytecode in a way that the Web browser doesn’t think it’s an image file or something. This is beginning to feel less like Web development and more like systems software development, and systems software development with a cross-compiler toolchain no less. I have a Docker image for that, but it’s still fundamentally more involved than getting an idea, writing it up in JS in some trivial HTML file, and loading the result to see how it works.

                      1. 1

                        My rant: it’s the usual chicken and egg problem.

                        I’d like to compile my “helloworld” source (“what’s your name? hello $name”) to some html + wasm files and then test it locally (firefox ./helloworld.html) without having to fiddle with server ports, javascript and npm.

                        1. 1

                          Who thinks that remotely executing opaque binary blobs is not good for security?

                          1. 5

                            I’m not sure that’s meaningfully different than minified/obfuscated JavaScript.

                            1. 1

                              There are IPS that monitor web traffic for attacks against browsers. Among other things, they detect and whitelist known js libraries and scan for suspicious patterns. Large binary blobs would make them ineffective.

                              1. 0

                                I don’t see how web assembly changes anything. You can always compile webassembly to JavaScript anyway.