lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

On Fri, Jun 8, 2018 at 1:25 PM Abhijit Nandy <abhijit.nandy@gmail.com> wrote:

What are my other options to reduce the size? I would like to bring down the Lua executable's size to about 10k like eLua!


I am one of the authors of eLua, and I've never heard of someone compiling it in such a small space (10k). Where did you find that information? I'd be very interested in those findings.
As for reducing the executable size, the VM is a fairly sensitive area, I wouldn't start from there personally.  Use a size profiler (such as https://github.com/google/bloaty) to figure out what's taking space in your executable, and start from there. You can try to reduce the contribution of external libs (mainly libc) to the executable size. For example, if you don't need floating point, compile it in integer mode only, then use GCC ARM embedded with Newlib-nano (a smaller libc that is included in the GCC ARM embedded toolchain). You can also try to remove all references to scanf, but that means removing the ability to read numbers from streams with "io.read". Obviously compile everything with "-Os". If you can use the ARM compiler (or IAR) instead of GCC, try that too, it might make your exectuable smaller.

Best,
Bogdan