18 ms·
WebAssembly’s post-MVP future
- kodablah 8y agoHere's a newly created proposals repo to keep track: https://github.com/WebAssembly/proposals https://github.com/WebAssembly/proposals. > Skill: 64-bit addressing As a WASM backend implementer in an environment w/ only 32-bit addresses, I hope people don't move to 64-bit addresses too soon. Are we really reaching the limits here already? > Skill: Portability [...] A POSIX for WebAssembly if you will. A PWSIX? A portable WebAssembly system interface. Yes please, but dev'd outside of WebAssembly. This is needed for interoperability between languages. Even just strings would be nice. A stdlib interface to rule them all, so to speak. If kept modular and avoided a lot of bikeshedding and had a full test suite, it could have a great benefit even outside of WASM.
- PowerfulWizard 8y agoAgreed on the stdlib concept. I'm sure people are working on it, the benefit would be massive. Just the amount of mobile data transfer that could be saved by 1MB of software pre-distributed to all browsers would be huge. I wonder if anyone is trying to do it based on the javascript integrity hashes. In theory, if you took the top 100 javascript libraries and established a blessed build pipeline that would produce reference builds that would be bundled to the browser, and if anyone loaded a resource with an integrity hash matching the browser's pre-installed versions, it could just load from disk instead. That would give people who can tolerate less frequent library releases the ability to use all that functionality without networking related page load costs, and would provide a fallback since CDN's could host the file anyway if the browser doesn't have it.
- Immortalin 8y agoYou can probably build a poor man's version with Subresource Integrity and the DecentralEyes plugin. https://decentraleyes.org/ https://decentraleyes.org/
- iainmerrick 8y agoJust the amount of mobile data transfer that could be saved by 1MB of software pre-distributed to all browsers would be huge. That would be great. I’m normally a fan of multiple competing implementations, but this might be an area where a single common library implementation, developed in partnership by all browser vendors, would be beneficial. All the code would be in wasm so it would be portable by definition. And with everybody using exactly the same implementation there shouldn’t be any sneaky incompatibilities. With a single master repo it could be versioned and updated cleanly. Just as long as it’s kept small (1MB sounds like a good goal) and there isn’t too much churn -- those are the real challenges.
- PowerfulWizard 8y agoYeah agreed, it is extra complicated since it requires coordination between browsers and also enough websites to make it worth it. If it were released today it could take years to register in i.e. global internet statistics. I guess in theory shared CDN's and caching should be almost as good as well if major website could agree on dependency sharing.
- comesee 8y agoI've been following wasmjit quite closely and they are implementing a PWSIX interface for WebAssembly.
- TomMarius 8y agohttps://github.com/CommonWA/cwa-spec https://github.com/CommonWA/cwa-spec
- Game_Ender 8y ago64 bit addressed cannot come soon enough. In certain domains the entire data set you want to work with is many times the 4GB limit, and JS has no such restriction so it’s a PITA that WASM does.
- dmitrygr 8y agoIt is hard to imagine a tool less suited to working with multi-gigabyte data sets than JavaScript.
- bloomer 8y agoYeah I'm really confused why working with 4GB+ datasets in the browser is a current need. Why does everything end up in web browsers these days? Is it only because developers aren't familiar with anything else?
- jholman 8y agoYou might similarly ask why app stores on iOS and Android are such a big deal, and why Steam is even a thing. It's because deployment is a harder problem than development (at least, it's harder for developers, because deployment is a social problem). The web is a pretty poor development target (though it keeps getting better), but it's a damn terrific deployment medium, and that's a winning tradeoff.
- denniskane 8y agoA truly web-browser-centric development/deployment workflow is slowly but surely becoming a thing. I call it "Linux on the Web": Easy as A-B-C / Or 1-2-3 / It's L-O-T-W ~dot~ X-Y-Z!
- fulafel 8y agoNon-browser programming platfomrs terrible portability stories when your app needs many features from the platform, like accelerated graphics, networking, security etc.
- __s 8y agoWASM's gc story will be tough to outline, it's going through its own MVP cycle in omitting finalizers & weak references
- francasso 8y agoThe threading description is highly misleading, the current proposal being implemented is based on WebWorkers, they are not just native OS threads with a small overhead
- luke_wagner 8y agoThat's true for the "threading MVP", but there is also discussion about adding "pure wasm threads" as a follow-up which avoids worker overhead/limitations.
- hencq 8y agoI wonder if eventually with some of the stuff like GC in place, you could write a javascript JIT on top of wasm. I'm only half kidding. It would be pretty neat if wasm became a kind of universal IR that different (AOT and JIT) compilers could target.
- jhpriestley 8y agoJIT is pretty hard to do with wasm. There's a strict separation between code and data in wasm, for security reasons. You can't jump into the heap. So the best you could do is to generate your new JITted code as a separate wasm module.
- hencq 8y agoAh interesting, thanks for clarifying. I'm way out of my depth here, but this could become possible if a future version of wasm provided the option to dynamically load code? After some googling, that's what this [1] seems to be talking about. [1] https://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation https://webassembly.org/docs/future-features/#platform-indep...
- s-macke 8y agoThat's exactly what I was thinking when I tried a more theoretical approach to my web emulator. I wrote a little about my approach in the Wiki [1]. Definitely one of my worst hacks :-) . Unfortunately the demo doesn't work anymore. I need to find out why. [1] https://github.com/s-macke/jor1k/wiki/Breaking-the-1-billion-instructions-per-second-barrier-via-Dynamic-Recompilation-and-WebAssembly https://github.com/s-macke/jor1k/wiki/Breaking-the-1-billion...
- dbielik 8y agoThe visualizations in this article are excellent!
- Crespyl 8y agoI believe Lin Clark is the artist, she has a whole series called "Code Cartoons" where she explains various (usually web related) technical systems like WebRender in similarly excellent style. [0] https://code-cartoons.com/ https://code-cartoons.com/
- skybrian 8y agoI'm reminded a bit of Java's early days when Sun was able to create the illusion that it would take over the world. WebAssembly has had a lot of early success and its limits are hazy, but it seems like they must be out there somewhere? To speculate: On the server side, it seems like docker format has already won. Maybe cpu architecture portability doesn't matter there and x86 is good enough? Although serverless and edge computing often use JavaScript. On mobile this seems to depend on Apple and/or Google deciding to support WebAssembly for native apps, which seems unlikely. Developers need laptops to run their development environment in. I'm wondering if this might just be Linux tools running in a container on your laptop. Chromebooks seem to be moving in that direction. The revival of something like Sandstorm might be interesting, but that's pretty speculative.
- eksemplar 8y agoI’m not impressed by wasm yet. One of the reasons JS is so good is because it can manipulate data without doing a full page reload, and wasm will do that, but another important reason is how productive modern JS is. I’m not a UXer, never was, and I moved into management long before programs even got pretty so I’ve never even had to pick up. Yet I can make a pretty web application with vue with minimal efforts. Add stuff like graphql, and wasm looks so ridiculously old aged before it’s even born. Of course that kind of defeatist attitude is silly, and I’m looking forward to see where wasm goes in the coming years, because if people just gave up, I wouldn’t have been able to make a pretty app in vue either.
- vvanders 8y agoOn the other side I see huge potential for WASM because all the things I worked with in C/C++/Rust that required a client-side install are now available to me on the browser. Stuff like UnrealEngine running in browser, low-latency audio processing, etc. Lots of potentially cool solutions where you need strong control over allocations and memory placement.
- goatlover 8y agoWasm isn't really for pretty apps you can quickly make in Vue. It's more for those heavy duty apps, games or libraries that most people run natively because of performance and because they're written in languages like C++, Rust, or even Fortran (scientific computing libraries). Also, JS isn't the best tool for all programs, and programmers would like more of a choice when it comes to things that are more than just your standard web app.
- fulafel 8y agoIt would be a shame if these improvements were restricted to WebAssembly only. For most modern high level languages, JS remains a much better compile target than WebAssembly for the foreseeable future.
- fabian2k 8y agoIs there already a performance advantage with the current WASM implementations for number crunching code compared to writing plain Javascript? My experience is that modern JS engines are already pretty good at optimizing that kind of code, so I'm wondering if there are still significant speedups to be had by using WASM, given that it's still pretty new and didn't have much time to get optimized further yet.
- username223 8y ago> Is there already a performance advantage with the current WASM implementations for number crunching code compared to writing plain Javascript? I may be out of date here, but IME neither JavaScript nor WASM is any good for actual "number crunching" (i.e. statistical or scientific code). For that, you want at least a compiler/language that uses the latest SIMD instructions and lets you choose 32- or 64-bit floats. Better still, you want one that automatically parallelizes loops (you may need to align your data), gives you cheap GPU access, and above all is simple enough that you can figure out why the compiler isn't performing the optimizations you expect. Modern JS engines are pretty good at speeding up the weirdness that is JS, so maybe WASM will only have small benefits, but using either for numerical work would be making your life unnecessarily hard.
- AgentME 8y agoWASM does let you choose between 32 and 64 bit floats. SIMD and threading are mentioned in the article as things that are being worked on now. GPU access is about browser APIs rather than being something tied to WASM. We have webgl now and it seems like there's more coming hopefully (https://github.com/gpuweb/gpuweb https://github.com/gpuweb/gpuweb). >and above all is simple enough that you can figure out why the compiler isn't performing the optimizations you expect. Reading WASM seems easier to me than reading real assembly, so double-checking a WASM compiler's output seems much easier than double-checking a native compiler's output. Of course it's on the compilers to support WASM well, but hopefully that simplicity aids them too.
- maga 8y agoI have done some benchmarking comparing JS, WASM, and native C++ addon performance in Node.js: https://github.com/zandaqo/iswasmfast https://github.com/zandaqo/iswasmfast From the look of it, in Node.js, WASM suffers less data exchange overhead while been decently close to performance of the native addons.
- jholman 8y agoOkay, I've only done the over-breakfast skim of this, and I hate to be that guy who comments without having fully read TFA, but here I go anyway... I don't see any explicit mention of what I understand to be the killer feature: the ability to directly access the browser's WebAPIs, from Accelerometer to Document to MimeType to XPathExpression. Start with modifying the DOM, and go from there. Of course fast WASM/JS interop lowers the cost of the obvious workaround. And yes, there's discussion in the article of getting WASM to play nice with JS GC, which I understand is a prerequisite. But there should be explicit discussion of what the predicted path is for making WebAPIs available in WASM, what the sub-goals are, and how to measure progress. And the first paragraph of the article is a joke, claiming that people thought the 2017 version was the final version. No, we're waiting for a relevant version (this sentence is an exaggeration, but it's more true than what TFA said).
- tyingq 8y agoIt seems to be tracked under/after GC, since that would be a prerequisite. See https://github.com/WebAssembly/gc/blob/master/proposals/gc/Overview.md https://github.com/WebAssembly/gc/blob/master/proposals/gc/O.... Things like DOM access are specifically mentioned.
- kodablah 8y agoWhat is the meaningful difference between WASM/JS interop and WASM/Web-API interop? Implicit importing of them all? There are host bindings coming [0]. If Web APIs are expressed in terms of JS and you want interop with them, you use what they are expressed in. Or are you saying Web APIs should be available in WASM terms (which is harder due to lack of structural, array, string, null, etc types)? 0 - https://github.com/WebAssembly/host-bindings/blob/master/proposals/host-bindings/Overview.md https://github.com/WebAssembly/host-bindings/blob/master/pro...
- jdc 8y agoPerformance
- 8y ago
- msoad 8y agoI used to think without DOM web assembly is uselsess then I saw how Figma made their UI super fast rendering to a canvas and was convinced that hopefully WS will be the reason DOM apis go out of fashion
- mbebenita 8y agoAFAIK, Figma only uses WebGL/Canvas for non-UI elements.
- sk1pper 8y agoHow does this not end up as Flash reincarnated though?
- roblabla 8y agoWhat part of flash was bad? - the (bad) sandboxing? WASM uses the same sandboxing model as JS, and thus provides the same security guarantees? - the requirement of an external plugin? WASM comes preinstalled in all browsers. - the proprietary aspect? Wasm is an open standard. - the obfuscated nature? WASM can be decompiled very easily. Besides, js served by modern websotes are already minimized and obfuscated beyond recognition. What am I missing here? I consider Flash to be a truly great piece of technology. It allowed easy creation of multimedia contents Its flaws were in its implementation, not in what it allowed. I want wasm to succeed as a reincarnated, better flash.
- mkl 8y agoAccessibility is a big problem.
- nchie 8y agoHaving to reimplement things such as text selection, clipboard, and making it more or less impossible to write plugins which affect the pages being shown (adblock, reddit enhancement suit, etc) are a few huge reasons. I'd prefer to keep the web consistent for sites which don't actually need to be rendered on a canvas.
- Vinnl 8y agoWow. Never did I expect it to generate this much (potential) innovation back when asm.js was announed. Pretty excited to be following on, even though I personally probably won't be writing anything for WASM any time soon - though this excellent series on Mozilla Hacks probably also played a role.
- tehsauce 8y agoWhat is the state of expanding GPU programming APIs in the browser? Seems that one of the biggest factors holding back the development of media applications for photo/video editing, games is a lack of a modern graphics api and first class GPGPU support. A while ago there was momentum towards webGPU and webVulcan but these projects seemed to have quieted down. We did get Webgl 2.0 but there is still tons of room for improvement and much to be gained!
- flohofwoe 8y agoAFAIK the current WebGL-successor-work happens here, and there's very recent activity: https://github.com/gpuweb https://github.com/gpuweb No idea how long until we can play around with it in browsers though.
- ArtWomb 8y agoChrome team has also announced intent to implement WebGPU on most platforms https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/dxqWTSvyhDg/1UDaFD17AQAJ https://groups.google.com/a/chromium.org/forum/#!msg/blink-d... In addition to rich applications for 3D modelling, photo editing, etc. Adoption of WebXR as a distribution platform for VR/AR content could drive development. MagicLeap's Asset Builder Web Tool for example is built on top of NextJS and ThreeJS
- zimbatm 8y agoI'm a bit concerned by the addition of Garbage Collection to WASM. Is there a way to implement those without favouring some type of language? It seems to me that GC tuning and memory models are very language-specific. A purely-functional language like Haskell or Closure can make different assumptions about the memory regions but also generate a lot more young generation items compared to OOP languages.
- amelius 8y agoWhy not implement the GCs themselves using low-level WASM code? That would enable a language-agnostic approach (though it would prohibit collecting garbage over multiple cooperating languages at the same time, which is a less urgent problem imho).
- rkangel 8y agoYou've already got 2 co-operating languages - JS and whatever is compiler to WASM.
- amelius 8y agoTrue, but once you're using WASM, you probably don't need to hold references to JS objects that point back to the objects created in WASM. We've been interfacing C with e.g. Python without needing a garbage collector that crosses language boundaries. So why would we need one now?
- arduinomancer 8y agoMaybe a stupid question but why does the browser itself need to do compilation? Why can’t WebAssembly developers compile ahead of time and just serve the binary?
- AndrewDucker 8y agoBecause they don't know what they're compiling to. The browser could be running in a wide variety of hardware.
- arduinomancer 8y agoRight, seems obvious now, thanks
- sp332 8y agoAndrewDucker I think has the main point, but it's also easier trust and sandbox a binary that you've built yourself.
- mactrey 8y agoThis is answered in the article (pretty far down, I'll admit): >But if all we have is the link, there are two problems here that we haven’t addressed. >The first one is… you go visit this site and it delivers some code to you. How does it know what kind of code it should deliver to you? Because if you’re running on a Mac, then you need different machine code than you do on Windows. That’s why you have different versions of programs for different operating systems. >Then should a web site have a different version of the code for every possible device? No. >Instead, the site has one version of the code—the source code. This is what’s delivered to the user. Then it gets translated to machine code on the user’s device.
- rkangel 8y agoTwo reasons: Portability - you would need to know what you're compiling for, in the same way you need to compile a different version of your program for your PC and your phone. You could imagine a system where some pre-compiled versions exist for certain browser/host combinations to make life faster for the majority case thought except: Security - the primitives that WASM has available are limited and only affect stuff in the sandbox. The browser then compiles that to machine code and can know that the machine code will only affect stuff in the sandbox. This is exactly how JS works - unless there's a browser bug, JS can't write to an arbitrary place on your harddisk (for instance). If machine code was provided directly, then the browser couldn't easily verify that the machine code only did safe things (because machine code can do anything, unlike WASM).
- ConanRus 8y agoThis is all right and all, but I have one question: why the hell it needs to be inside of a browser? To do what exactly? I don't care about browsers, I care about applications. I don't want freaking Photoshop in my browser, because I want a browser to die. This should be a part of the OS, not a freaking browser. Give me a built-in runtime with sandboxing, a delivery method, and an AppStore. Give me next generation Java/Flash. I tired of a browser as an OS replacement. It is not and it shouldn't be.
- corey_moncure 8y agoDude, like, just get with the program, man.
- justinclift 8y agoSomething like these? * https://github.com/Xe/olin https://github.com/Xe/olin * https://github.com/WAVM/WAVM https://github.com/WAVM/WAVM
- msla 8y agoBecause it effectively solves the distribution problem in a way which includes non-technical people. If you think your solution does that, meditate on what "non-technical" means.
- user111233 8y agoHaving the URL system also makes them so much better for sharing. Imagine being able to share a link that someone could click and it would open up your shared image inside of photoshop.
- pjmlp 8y agoAndroid, iOS and UWP do that with deep links.
- moosingin3space 8y agoWhy is it such a bad thing for a browser to act as an OS?
- kristianp 8y ago"The tail calls proposal is also underway", but the repo hasn't had a commit in 5 months. https://github.com/WebAssembly/tail-call/blob/master/proposals/tail-call/Overview.md https://github.com/WebAssembly/tail-call/blob/master/proposa...
- matthberg 8y agoThe parallels with the Destroy All Software talk "The Birth and Death of Javascript" [0] are crazy. Seeing the section where they address the possibility of Node modules and system access from WASM is like seeing a flying car advertisement in real life. [0]:https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://www.destroyallsoftware.com/talks/the-birth-and-death...
- tabtab 8y agoRe: like seeing a flying car advertisement Ditto the feeling. I don't "get" WASM from a typical in-house CRUD development. Game makers, maps, movie editors; sure they need the speed. But some say it's gonna revolutionize most browser-based application dev, but I can't get specific examples that are relevant to us. And even for those domains listed, relying on inconsistent and buggy DOM as found in browser variations is a problem it probably won't solve. DOM will still suck as a general purpose UI engine. WASM just makes DOM bugs run faster.
- pcwalton 8y agoThe DOM isn't particularly "buggy", relative to, say, Win32 or Cocoa. It may or may not be a bad API, but implementations are pretty solid. (I have to confess I've never understood the objections to the DOM. I have literally never had an instance in which I had to use the raw Win32 API that didn't turn into a miserable experience.)
- tabtab 8y agoWith Win32 and Cocoa you pretty much have one vendor with roughly 3 or so major releases. But with browsers you have roughly 8 vendors above 1% market-share with 3 or so (notable) major releases each. Therefore, you have to target roughly 8x more variations of the UI engine. Look how hard Wine's job is to be sufficiently compatible. I believe we need to either simplify the front-end standards (pushing as much as possible to the server), or fork browsers into specialities: games, media, CRUD, documents, etc. What we have now sucks bigly. Try something different, please!
- zackbloom 8y agoYou can deploy WebAssembly to 154 data centers as a part of Cloudflare Workers if you'd like to play with it: https://blog.cloudflare.com/webassembly-on-cloudflare-workers/ https://blog.cloudflare.com/webassembly-on-cloudflare-worker...
- justinclift 8y agoOn a semi-related point, TinyGo (a subset of Go for embedded devices) recently added a WebAssembly output target: https://github.com/aykevl/tinygo https://github.com/aykevl/tinygo) Unlike the current mainline Go's WebAssembly output (min ~2MB file size), the Wasm generated from TinyGo is practical in size. eg ~1kb for the toy examples This is all leading edge dev stuff too, so updates and improvements are happening pretty frequently. :)
- sametmax 8y agoYour comment just made me realized that, while using cPython => webassembly for something else than electron would be overkill, this would be kinda neat for microPython.
- justinclift 8y agoYep. If you want to add it, that would be kinda neat. :)
- fulafel 8y agoThere seems to be some work on it: (1) https://github.com/micropython/micropython/pull/3575#issuecomment-425346070 https://github.com/micropython/micropython/pull/3575#issueco... (2) https://github.com/matthewelse/micropython/tree/emscripten/emscripten https://github.com/matthewelse/micropython/tree/emscripten/e...
- user111233 8y agoFrom what I have seen it looks like Mozilla and Firefox are really leading in WASM. All these detailed posts explaining it in easy to understand terms are amazing as well.
- bayesian_horse 8y agoI'm looking into building a state-management system for React with Pyodide. Yes, it might add 3mb to the downloads, but that should be acceptable. It will probably use some kind of asyncio work-alike which will use Web-Apis to perform what asyncio normally does.
- upofadown 8y ago>People have a misconception about WebAssembly. They think that the WebAssembly that landed in browsers back in 2017—which we called the minimum viable product (or MVP) of WebAssembly—is the final version of WebAssembly. They do? When people point out that WASM can't do stuff they are simply pointing out that WASM would need to be extended. That is a pretty simple concept and a very important observation because historically that is the phase where everything falls apart. Creating an intermediate language that all the higher level languages can compile to is not a new idea. It has been done over and over again with little practical result. Some current scepticism is in order.
- candiodari 8y agoI don't get this. What would you write in this language ?
- ToFab123 8y agoI dont think you will write in that language. You will compile to that language from whatever language you prefer to write in.