Lua 5.5.0 support static (fixed) binaries, as the document said "when
loading a binary chunk in memory, Lua can reuse its original memory in
some of the internal structures"
But I think we can do it more thoroughly.
I think the whole proto structure can be fixed , not just lineinfo and
abslineinfo.
In order to implement it, we need to add an external short string type
for the short strings in constants, and using offset rather than
memory address for the pointers.
The benefits :
1. Loading lua bytecodes (undump) can be O(1).
2. Save more memory for embedded environment.
3. Save lots of memory for a large number of virtual machines. (We
used thousands of lua states in one process)
Generating a standalone lua virtual machine with the same code is much
lighter, the cost is almost the same as generating a Lua closure.
--
http://blog.codingnow.com