lua-users home
lua-l archive

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

On Fri, Jan 5, 2018 at 2:07 AM, Paige DePol <> wrote:
Lua v5.3.4 compiles to appx 230k when built with optimisation (-Os) on my
system... which is quite compact, and is often touted as a primary benefit
for embedding the language.

As I've been hacking on Lua and adding more features this size has been
increasing, with all my patches I have just hit a megabyte in size in a
release build. However, it should be noted that a bulk of this size is in
the parser/lexer portion of the code. I have strived to make the runtime
portion of the code remain as lean as possible. I do not have numbers yet
but will be adding the ability to calculate the growth of the Lua binary,
including compiling with the parser/lexer and without, for all my patches.

I was wondering at which size would the Lua binary be considered "too large"
for embedding and the like. I am going to guess that this really would just
depend on the target environment... however, as I know there are people on
the list using Lua in embedded environs I thought I would get some feedback.

I'm happy to say that we've been using Lua as part of Storyboard, an embedded
UI development framework ( if you are interested) for nearly 
10 years specifically because it is perfectly suited for the resource constrained
environments we work with.  While it varies from platform to platform, and we 
do adjust the configurations a bit, we generally run about 150K text and 60K
data on the binary itself.   

For embedded systems the parser/lexer could just be left out, obviously this
would require all necessary Lua code be pre-compiled (another good reason
for adding cross-platform bytecode genereration to 'luac' in my opinion). I
was also wondering if people who embed Lua precompile the source or not?

We do offer pre-compilation as an option for our scripts, but more to save on
processing time (do ahead of time to avoid runtime costs) than memory.   It is
certainly on the table that if we needed to we could strip these elements out and
just force pre-compiled scripts for much smaller environments.
The target for my Lua variant is game engines, so while embedding is not
necessarily my target audience I am just curious about embedded use cases.
I am also curious just at which point people consider the binary to become
"bloatware" vs the vanilla binary size.

For what it is worth, I would consider what you have packaged as being far too
large for us as we're running on systems with <1M RAM and then varying amounts
of flash.  The code size is fine if you have lots of flash, but then it frequently translates
into a higher dynamic memory cost for the features you are now including which is
usually what gets us (as a UI framework) into the tight resource spots.

Thanks for your thoughts!

Happy to give them .. I'm interested in hearing what others have to say about it.
Thomas Fletcher
VP Research & Development
t. +1 (613) 595 1999 x511
c. +1 (613) 878 4659