Trials and Tribulations of Native Lua Compilation

(samyeyo.github.io)

16 points | by _samt_ 3 days ago ago

4 comments

  • Philpax an hour ago

    This is of interest to me, but I have no idea why you'd set `height: 720px`. I had to turn that off to make it readable.

  • wiradikusuma an hour ago

    If it has to go through compilation process to make it native, doesn't that defeat the purpose of Lua? I mean, why not just use the same language of the host application, in other words, just another function/module of that app.

    • PhilipRoman 39 minutes ago

      1) You can use interpreted version for rapid development and switch to compiled for release

      2) You may like Lua as a language and want to use it for general purpose programming, not necessarily embedding into host program

      I will say though that the performance aspect has to be taken with a grain of salt, "native compilation" is not a meaningful improvement if every source line translates to multiple branches or vtable lookups. From my experience plain conversion of Lua to C (assuming you faithfully follow the specification, including coroutines, metatables, etc.) produces equal or slower code with rare exceptions for numerical loops. If it wasn't all AI generated I'd maybe spend time understanding this project.

  • _samt_ 3 days ago

    A technical write‑up about the difficulties of compiling Lua to native code, based on my experience developing clx