News for hackers. Stuff that matters.
Re:What makes WebAssembly fast? by pmontra on Tuesday February 28, 2017 @06:17PM (#13759223)
> At least 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.

Ouch, back to the 80s, early 90s. I think I'll stick with JavaScript at least until WebAssembly gets garbage collection. I might be wrong but I don't see many people writing SPAs in C++ for the extra speed (let's say, the JS layer acting like an X Server for the DOM, driven by a C++/WebAssembly application). Games, yes.

Furthermore JS has view source. WebAssembly has a text format [1] but it's really assembly. Hopefully there will be source maps [2].

[1] http://webassembly.org/docs/text-format/

[2] http://webassembly.org/docs/tooling/

Re:What makes WebAssembly fast? by callahad on Tuesday February 28, 2017 @06:28PM (#13759306)
You don't have to go back to the 80's to develop closer to the metal. Neither Rust nor Swift have garbage collection, but both are thoroughly modern, productive languages. I've also been told that C++14 is reasonably pleasant, but I have no personal experience with which to judge.
Re:What makes WebAssembly fast? by matthewmacleod on Tuesday February 28, 2017 @06:43PM (#13759428)
Swift is garbage-collected – it might not have a tracing GC, but ARC is essentially compile-time GC – certainly, from the perspective of a developer, ARC is extrordinarily similar to a tracing GC (with some small caveats).
Re:What makes WebAssembly fast? by int_19h on Tuesday February 28, 2017 @07:00PM (#13759546)
Reference-counted GC is trivially implemented on top of WebAssembly memory model.
Re:What makes WebAssembly fast? by wyldfire on Tuesday February 28, 2017 @08:47PM (#13760216)
"compile-time GC" sounds like it would apply to C/C++'s automatic storage duration too.
Re:What makes WebAssembly fast? by deburo on Tuesday February 28, 2017 @07:17PM (#13759680)
The lack of GC is a benefit here. Remember, WASM as an MVP is meant to bring C/C++ codebases on the web.

There is plenty to be excited about here. This will enable faster [media apps, games, etc](http://webassembly.org/docs/use-cases/) on the web. Wasm is knocking at the door and I can't wait to see what it's bringing with it.

Edit: HN really should support a few more formatting options.

Re:What makes WebAssembly fast? by Salgat on Tuesday February 28, 2017 @08:28PM (#13760136)
It's not a benefit, it's simply a temporary compromise to get it out faster.
Re:What makes WebAssembly fast? by hellofunk on Tuesday February 28, 2017 @06:35PM (#13759363)
There are a lot of developers -- a huge amount, actually -- who believe memory management is too important to leave to an automated GC algorithm. That, and the memory requirements of a particular application might require something different than a GC provides.
Re:What makes WebAssembly fast? by ktRolster on Tuesday February 28, 2017 @09:05PM (#13760308)
If your algorithm is such that everything can be placed on the stack then GC gets you nothing.
Re:What makes WebAssembly fast? by hellofunk on Wednesday March 01, 2017 @02:29PM (#13767351)
A lot of GC languages don't give you access to the stack, though, all objects live in the heap.
Re:What makes WebAssembly fast? by verletx64 on Tuesday February 28, 2017 @06:30PM (#13759325)
Isn't WASM a compile target?
Re:What makes WebAssembly fast? by hacknat on Tuesday February 28, 2017 @08:13PM (#13760045)
It doesn't prevent a language from adding its own GC.
Re:What makes WebAssembly fast? by kebolio on Tuesday February 28, 2017 @06:41PM (#13759419)
At least in Rust's case, RAII/lifetimes provide mostly the same development experience without GC overhead.