hugomg/lua-aot-5.4

Memory is very noticeably different.

Opened this issue · 2 comments

Using collectgarbage("count") after requiring a Lua library adds about 5-15kb but an AOT compiled library adds ~200kb. Considering the compiled C code is way larger and is representing the bytecode not an AST I understand why, I might make some PRs trying to reduce the memory usage of the compiled code.

And I am using -O3

hugomg commented

I suggest measuring how much of that 200kB is from static data (the source code arrays) and how much is the program itself (compiled C code). A known limitation of LuaAOT is that it generates a great amount of C code... One idea that might be easy for you to implement is to tell LuaAOT to only compile the "hottest" functions and leave the rest of the code alone.