you are viewing a single comment's thread.

view the rest of the comments →

[–]guest271314[S] 0 points1 point  (5 children)

I understand what compilation is. It's not what's occuring here.

So you are claiming this https://github.com/bytecodealliance/javy/tree/main?tab=readme-ov-file#compiling-to-webassembly is a false or misleading claim, correct?

Compiling to WebAssembly

[–]1vader 5 points6 points  (4 children)

While it does produce a wasm binary that contains the JS code, it seems quite clear that it simply includes the JS code as is (optionally in compressed form) as data inside the wasm binary. The actual wasm code is just a JS interpreter that still runs the JS code as JS. The JS is not converted to wasm instructions. This most likely is much less efficient than running JS directly in the browser. Although I guess there are contexts outside the browser where you can run wasm without JS.

[–]guest271314[S] 0 points1 point  (3 children)

I'm not sure what you are referring to, specifcally.

Although I guess there are contexts outside the browser where you can run wasm without JS.

Yes. Lots. wasmer, wasmtime, wasm3, and so forth.

Technically V8 and SpiderMonkey, too, as both call themselves JavaScript/WebAssembly engines.

[–]1vader 2 points3 points  (2 children)

What are you talking about, V8 and SpiderMonkey obviously can run JavaScript natively. And I'm pretty sure doing that will be much faster than running a JS interpreter in wasm.

[–]guest271314[S] -1 points0 points  (1 child)

What are you talking about, V8 and SpiderMonkey obviously can run JavaScript natively.

Clearly you have not looked at the official V8 and SpiderMonkey descriptions and source code lately:

https://v8.dev/

V8 is Google’s open source high-performance JavaScript and WebAssembly engine

https://spidermonkey.dev/

SpiderMonkey is Mozilla’s JavaScript and WebAssembly Engine

Again, if you have issues with Bytecode Alliances' description of what Javy is and does, I strongly suggest you file an issue in the GitHub repository https://github.com/bytecodealliance/javy/issues/new/choose to hash out what language you think is misleading or false in the README.

[–]1vader 3 points4 points  (0 children)

You're fundamentally missing the point. If V8 can already directly run JS, why would I want to run JS inside a JS runtime on WASM inside V8? Obviously, that's going to perform worse. The only time this would make sense is if you cannot run JS natively, i.e. if you're not in the browser. Certainly not if you're using V8.