logoalt Hacker News

PunchyHamsterlast Friday at 8:55 AM4 repliesview on HN

I start to think that's why there is still no DOM for the WASM and we have to pingping over JS

> Also the dirty secret of WebAssembly is that it's not really faster than JS.

That is near purely due to amount of work it took to make that shitty language run fast. Naive webassembly implementation will beat interpreted JS many times over but modern JIT implementations are wonder.


Replies

torginuslast Friday at 11:32 AM

For WASM, the performance target isn't Javascript - but native code and NaCl. Considering WASM has had tremendously more time and effort invested into it, and still underperforms NaCl (and JS) signals to me that this is not the right approach.

The WASM runtime ended up from something that ingests pseudo-assembly,validates it and turns it into machine code, into a full-fledged multi-tiered JIT, like what JS has, with crazy engineering complexity per browser, and similar startup performance woes (which was one of the major goals of Nacl/Wasm to alleviate the load time issues with huge applications).

show 2 replies
gritzkolast Friday at 9:04 AM

Yep. These things have been solved by massive investments. The question is, can WASM as a language (not an implementation) do something JavaScript can't?

show 2 replies
WorldMakerlast Friday at 5:02 PM

> I start to think that's why there is still no DOM for the WASM and we have to pingping over JS

I don't think you need conspiracy theories for that. DOM involves complex JS objects and you have to have an entirely working multi-language garbage collection model if you are expecting other languages to work with DOM objects otherwise you run the risk of memory leaking some of the most expensive objects in a browser.

That path to that is long and slow, especially with the various committees' general interest being in not requiring non-JS languages to entirely conform to JS GC (either implementing themselves on top of JS GC alone or having to implement their own complex subset of JS GC to interop correctly), so the focus has been on very low level tools over complex GC patterns. The first basics have only just been standardized. The next step (sharing strings) seems close but probably still has months to go. The steps after that (sharing simple structs) seem pretty complex with a lot of heated debate still to happen, and DOM objects are still some further complexity step past that (as they involve complex reference cycles and other such things).

moralestapialast Friday at 9:00 AM

I don't dislike JS but the reason why it's fast is because billions were poured into making that happen.

V8 is a modern engineering marvel.

show 2 replies