7 ms·
That was an interesting read, but why do Hermes (and React, React Native, etc) still use javascript as a compile target rather than Wasm?
by fergie 3y ago
That was an interesting read, but why do Hermes (and React, React Native, etc) still use javascript as a compile target rather than Wasm?
- iainmerrick 3y agoBecause the user’s code is typically written in JavaScript (or TypeScript)? Wasm isn’t a great target for JS.
- circuit10 3y agoHermes is a JavaScript engine, where does being a compile target come into this?
- neftaly 3y agoWasm needs to call into JS to do things like manipulate the DOM and use browser APIs, there's an overhead involved.
- tyingq 3y agoFor an idea of that overhead, see this older article: https://hacks.mozilla.org/2018/10/calls-between-javascript-and-webassembly-are-finally-fast-%f0%9f%8e%89/ https://hacks.mozilla.org/2018/10/calls-between-javascript-a... At first, it sounds really promising, like "wow, all the overhead is fixed". Until you get to the bottom and see: "Currently the only built-ins that we support this for are mostly limited to the math built-ins." So all those terrible "before" graphs mostly still apply today for most DOM interaction and browser APIs. A few more pieces still aren't done for that to work well. This has some pointers to current state: https://stackoverflow.com/questions/62587845/wasm-dom-access-and-reference-types https://stackoverflow.com/questions/62587845/wasm-dom-access...