Nelua: Ahead-of-time compilation of Lua-like language

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
pgimeno
Party member
Posts: 3689
Joined: Sun Oct 18, 2015 2:58 pm

Nelua: Ahead-of-time compilation of Lua-like language

Post by pgimeno »

Thanks to user neku, I have discovered this new compiler. It does not seem mature enough, but it's maybe interesting enough as to keep an eye on it for the future:

https://nelua.io/

The idea seems attractive. There are big pros and, unfortunately, huge cons. Still, it's something worth considering for integration into Löve as an alternative to LuaJIT, if that's possible.

The pros:
  • Faster than LuaJIT, because it's not an interpreter.
  • The output is C code, which compiles to a binary library or executable, therefore those who have concerns about sharing the source code will be happy with that. Also, it's immediately available everywhere where C is.
  • It has a number of interesting features, e.g. making the garbage collector optional, and preprocessor/metaprogramming.
  • It's more powerful for interfacing with external libraries; the downside is that it may also be more difficult.
The cons I can think of are:
  • Generating multi-platform executables is far more difficult, because you need a cross-compiler for every target platform.
  • It doesn't allow easily porting existing projects, because it currently lacks some essential Lua features, e.g. tables. This might change in future.
  • There's nothing even resembling a Lua-compatible API, therefore integrating it into Löve is expected to take quite some work.
  • It's WIP therefore not stable enough to use immediately.
There are probably more.
User avatar
Felix_Maxwell
Prole
Posts: 24
Joined: Wed Dec 04, 2019 3:15 pm

Re: Nelua: Ahead-of-time compilation of Lua-like language

Post by Felix_Maxwell »

How much faster do you think it would be than a Löve game that doesn't have any NYI functions? (In other words: a game that takes full advantage of the speed of LuaJIT)
User avatar
pgimeno
Party member
Posts: 3689
Joined: Sun Oct 18, 2015 2:58 pm

Re: Nelua: Ahead-of-time compilation of Lua-like language

Post by pgimeno »

Felix_Maxwell wrote: Sat Dec 12, 2020 5:18 pm How much faster do you think it would be than a Löve game that doesn't have any NYI functions? (In other words: a game that takes full advantage of the speed of LuaJIT)
I don't think that's possible with the current version, given that calls to most Löve functions (I think except for random number generation) are NYI. Anyway, according to the benchmarks and to my own experience with LuaJIT vs C, it could be about 1.5x to 2x faster.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests