TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

An Abridged Cartoon Introduction To WebAssembly

235 pointsby pk2200about 8 years ago

12 comments

IvanK_netabout 8 years ago
They often forget to mention, that WebAssembly is just a low-level programming language (much lower than C), it has extremely simple syntax (it has just four data types, no system calls, the specification takes 5 pages instead of 500 pages of C spec). You may call it a &quot;bytecode&quot;, but typical bytecodes also have around-500-page specifications.<p>Also, its relation to javascript is not any bigger than the relation to any other programming language (i.e. there is no relation). A WebAssembly VM could be made as an extension of any environment.<p>I recommend reading the official paper <a href="https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;spec&#x2F;blob&#x2F;master&#x2F;papers&#x2F;pldi2017.pdf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;spec&#x2F;blob&#x2F;master&#x2F;papers&#x2F;pldi2...</a> (I learned more than about 50 &quot;essays&quot; that I read about WASM in the past).
评论 #14343594 未加载
评论 #14347127 未加载
评论 #14396285 未加载
评论 #14346936 未加载
gavinpcabout 8 years ago
I&#x27;m of two minds about WASM.<p>There&#x27;s the Alan Kay attitude that we can build entire systems on top of minimal VM&#x27;s, rather than sacrificing power to bake in more facilities. But even he says that too much time has been wasted by teams reinventing the wheel (or flat tire) who didn&#x27;t really have the chops to do it.<p>The other side of that, then, is the great potential for interop that Javascript offers. We now have a worldwide platform with a built-in presentation layer and a highly-optimized interpreter with useful, reflectable data structures out of the box. (<i>edit</i> i.e. it&#x27;s a viable platform for metaprogramming... the endgame of which is JS-in-JS (see &quot;prepack&quot;)).<p>I would love to see a future in which the browser (and &quot;personal&quot; computer generally) remained a locus of significant computation. In practice, I suspect that highly-intensive tasks (mostly AI stuff) will continue to be done on servers, not because we lack the processing power, but because end users will have signed away the custody of all data worth processing. If that is the case, then WASM&#x27;s role will be to fill a fairly marginal gap, between what JS can do, and what has to be farmed out anyway.<p>So ultimately I hope that WASM offers a lifeline to the computing power that individuals still have. But given the state of JS (after huge investments), it feels like starting over again.
评论 #14342836 未加载
kowdermeisterabout 8 years ago
I&#x27;ll find it really amusing when devs outside the frontend world will storm in, devs who currently hate working with the browser because of JavaScript. The problem they will face is that a nice UI will still be needed. Since they will probably hate the DOM even more than than JS now they can just omit it. A canvas is canvas, right? :)<p>But then the next obvious problem will kick in. What should we use to implement a UI. GTK? WxPython? Swing? Tkinter? QT? JavaFX? Great candidates :) It will just be great. I mean not, but it will happen, because JS and &quot;browser tech&quot; is considered sub par (not by me, but I keep reading this).<p>WebAssembly will bring in lots of innovation, opportunities and also create the next level chaos. We will look back to the tooling hell as the good old days of frontend development :)
moron4hireabout 8 years ago
In 20 years of software development and trying different platforms, JavaScript has been the most frustrating and the most rewarding of all of them.<p>I find a lot of value in using JavaScript as a cross-platform shell. I personally do a lot of work on all of the major operating systems. I primarily (a light primary, like maybe 67%, not 90%) work on Windows, but most of my users are working on macOS. And we&#x27;re all writing software that eventually has to run on Android. There is almost never a problem I can&#x27;t solve using a JS project of some kind. That&#x27;s the rewarding part. I feel like my software goes a lot further on the JS platform than it could have ever gone on any other.<p>But it&#x27;s frustratingly slow. A lot of that is the poor quality of a lot of the libraries that are available. I&#x27;m not really keen on writing my own HTML templating system, but I&#x27;m afraid I might have to just to get the performance targets I want (I static-gen almost everything).<p>And I often feel like the language is not doing enough to help me. I love writing metaprogrammable systems, but the lack of easily accessible, standardized, advanced type information in JS is a big impediment to that. Sure, I can enumerate all of the methods an object has available to it, but there is no good way to enumerate the parameters those methods take, their return type, or even that they <i>are</i> methods, if I ever happen to get a reference to one of them sans the object from which it came<p>And yes, I still do object oriented programming. But the functional story in JavaScript is not any better. With map, filter, and reduce being methods on Array, coupled with JS&#x27;s goofy OO semantics where methods can become detached from their objects if they aren&#x27;t explicitly bound to them, things become frustratingly verbose to get basic functional patterns to feel good.<p>So a WASM that let me build better dev tools, in better languages, without losing that cross-platform capability, would be a godsend. Having it run in the browser also is just icing on the cake at this point.
评论 #14346448 未加载
vivinabout 8 years ago
&gt; For now, WebAssembly does not support garbage collection at all. Memory is managed manually (as it is in languages like C and C++). While this can make programming more difficult for the developer, it does also make performance more consistent.<p>Does this worry anyone else? Or I am getting worked up over nothing?
评论 #14343260 未加载
评论 #14343163 未加载
评论 #14344152 未加载
评论 #14343211 未加载
tamatabout 8 years ago
after reading many tutorials about WASM I still figured out one of the most important questions for me:<p>Would I be able to call JS functions from WASM? or pass callbacks to WASM. Because WASM sounds like it goes agains the async nature of JS and I have the feeling that is going to be very annoying to merge both worlds.<p>Also if I cannot call any JS func from WASM it means I cannot call WebGL or Audio so I dont know what would I need the performance if I cannot access the most performance demanding APIs.
评论 #14344392 未加载
评论 #14343554 未加载
评论 #14343756 未加载
Slackwiseabout 8 years ago
Oh cool, the text format[1] appears to be s-expressions!<p>Sounds like an easy dump from AST to text to wasm. Aside from what the Google Closure Compiler provides, I wonder what benefit, if any, this may give to ClojureScript. I&#x27;m guessing CLJS will just keep Google Closure for its optimizations, while Google Closure will output either wat files or wasm files. Unless optimizations can just be done during wat to wasm, which would be ideal for other language authors who can just translate to their intentions and not have to worry so much about fancy optimizations. (I&#x27;m rambling at this point. Sorry.)<p>[1]: <a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;WebAssembly&#x2F;Understanding_the_text_format" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;WebAssembly&#x2F;Underst...</a>
jorblumeseaabout 8 years ago
Question...<p>The issue is that JIT js is hard to improve performance on because it&#x27;s a dynamically typed language. Even with Web Assembly, something will still need to compile down into the bytecode to run. So perf is going to depend on that step in whatever language you write in and how easily that converts and optimizes into web assembly standards.<p>Does this mean that strongly typed languages have a performance advantage, given that they will be able to easily compile down into optimized typed bytecode?
ameliusabout 8 years ago
Since JS is already quite fast nowadays, how much faster will WASM typically be?<p>(Yes, I know, it depends. I&#x27;m just looking for a rough estimate.)
评论 #14342389 未加载
评论 #14342178 未加载
评论 #14342121 未加载
评论 #14342068 未加载
评论 #14342149 未加载
评论 #14342904 未加载
评论 #14344614 未加载
评论 #14342750 未加载
评论 #14342173 未加载
ericfrederichabout 8 years ago
Currently browsers only support JS. If you want another language you have to transpile to JS or implement your language in JS, etc.<p>If the browser vendors were going to add another language I would have hoped it would be something so generic like LLVM instead of this WebASM which is too tied to JS.
评论 #14346967 未加载
评论 #14344633 未加载
评论 #14346460 未加载
backtoyoujimabout 8 years ago
Is javascript being used as an ORB and this <i>possibly</i> binary byte code is a bit of machine readable IDL ?
acomjeanabout 8 years ago
Looks really interesting, but How does one debug the web assembly code?
评论 #14343078 未加载
评论 #14343204 未加载