lua.vm.js icon indicating copy to clipboard operation
lua.vm.js copied to clipboard

WebAssembly

Open stuta opened this issue 8 years ago • 9 comments

Emscripten has WebAssembly backend. Have you tried what is the performance?

https://github.com/kripken/emscripten/wiki/WebAssembly

stuta avatar Jan 14 '17 13:01 stuta

Yes please !

giann avatar Jan 18 '17 09:01 giann

FWIW Webassembly should not bring us much: it's just a new bytecode format. I expect the main improvement will be in page load time. However it comes at the huge cost of browser compatibility.

I'll give it a try at some point, but for now I don't even have a browser installed that supports it. If someone else wants to do a comparison feel free.

daurnimator avatar Jan 18 '17 09:01 daurnimator

Well bypassing js is bound to be faster no ?

giann avatar Jan 18 '17 10:01 giann

Well bypassing js is bound to be faster no ?

asm.js (which lua.vm.js uses) is already specially processed by browsers. While still being valid js (so works at a snail's pace all the way back to pre IE6; which is great if you want to replace javascript's place on the web entirely)

daurnimator avatar Jan 18 '17 13:01 daurnimator

For test purposes I did build to WebAssembly.

I had to make some ugly changes to make it work. The js object is not populated yet. But it works if anyone is interested.

giann avatar Jan 18 '17 13:01 giann

@giann It looks like WebAssembly is now stable, and it would be awesome to get formal support here. I'm hoping to build a cross-platform game using Lua as a scripting language, and being able to write the bulk of my logic (everything except rendering, that is) in WebAssembly calls would be awesome.

Have you tried doing this recently? I think WebAssembly was stabilized earlier this week, so I'm guessing not yet. If you don't have a chance, I may play with it this weekend. I wonder how it'll compare to native JavaScript.

As for this project, is this the proper place to propose merging patches to make it work with wasm?

beatgammit avatar Mar 09 '17 17:03 beatgammit

being able to write the bulk of my logic (everything except rendering, that is) in WebAssembly calls would be awesome.

Why? (I'm not sure what benefit this brings)

I may play with it this weekend. I wonder how it'll compare to native JavaScript.

Let me know how you go.

As for this project, is this the proper place to propose merging patches to make it work with wasm?

Yes.


PS, @giann started the project https://github.com/giann/fengari at my suggestion after discussing this thread elsewhere.

daurnimator avatar Mar 10 '17 02:03 daurnimator

Webassembly should not bring us much

Have you seen the WebAssembly GC/DOM integration page?

craigbarnes avatar Apr 29 '17 19:04 craigbarnes

Webassembly should not bring us much

Have you seen the WebAssembly GC/DOM integration page?

Looks like they've added to it a bit since I saw it last; but it's still all just unconfirmed plans with no implementations.This is in addition to the fact that these new features won't ever work in legacy (or current) browsers.

In 3 years when the code exists we can start work on an implementation. In 7-8 years there should be enough browser penetration that we might be able to use it for non-demo purposes.

daurnimator avatar May 01 '17 01:05 daurnimator