Re: LuaJIT and WebAssembly

  • From: Haoran Xu <haoranxu510@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 11 Aug 2022 02:13:54 -0700

Would it be possible to bring the full speed of LuaJit to WebAssembly?
You cannot use Emscripten to compile LuaJIT to WebAssembly, since the
Emscripten embedding won't allow you to JIT code for security (as doing so
will ruin WebAssembly's sandbox).

I also looked into compiling Lua code directly to WebAssembly and I think
the best way would be to convert it to TypeScript. Am I missing something?
You might be able to transpile Lua to Javascript, but clearly not
TypeScript as you cannot statically determine the types in your Lua code.
Even so I suspect there's going to be a big perf loss if you want to
simulate Lua's semantics using Javascript. I think there is some work that
implements Lua VM using Javascript but I don't know its performance vs
native Lua VM.

Hope it helps.
Haoran

David Dengg <david.dengg@xxxxxxxxx> 于2022年8月11日周四 02:01写道:

Hello LuaJit List,

we want to use LuaJIT in our company but we also target the web. Right now
we use Emscripten to compile our C++ code to WebAssembly. Would it be
possible to bring the full speed of LuaJit to WebAssembly?

We are open to sponsoring the project if it we can have the full speed of
it on the web.

I also looked into compiling Lua code directly to WebAssembly and I think
the best way would be to convert it to TypeScript. Am I missing something?

Thanks,
David

Other related posts: