lua-users home
lua-l archive

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


On 1/6/2018 10:48 AM, Sean Conner wrote:
It was thus said that the Great Paige DePol once stated:

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?

[snip snip snip]

   Again, similar results, only the 64-bit compiled versions are larger than
the 32-bit compiled versions.  The trick here is to determine if the size
savings of compression are worth the extra cost of zlib support.  There's
also the question of whether the reduction in Lua size of removing the
parser is worth the larger size of pre-compiled Lua code.

   -spc (Trade-offs, trade-offs)

More of a speed/size trade-off if we look at the available compression tools.

For a bit better size, one can use the last word in deflate compression, Zopfli [1].

[1] https://en.wikipedia.org/wiki/Zopfli

Also, one can merge data into a single file. This allows deflate to work better, since the sliding dictionary size is 32KB, and some savings will be due to fewer Huffman tables due to having fewer data blocks.

Or one can go for better size at a faster speed, use the new-and-hot finite state entropy methods, Zstandard [2] or LZFSE [3]. See the benchmark in [4].

[2] https://en.wikipedia.org/wiki/Zstandard
[3] https://en.wikipedia.org/wiki/LZFSE
[4] http://facebook.github.io/zstd/

Zlib is still good enough for a lot of use cases. Zstandard seems to match or is better than LZMA. One issue is some patent legalities that might run afoul of corporate lawyers. See this excellent post [5].

[5] https://gregoryszorc.com/blog/2017/03/07/better-compression-with-zstandard/


[1]	Using zlib (lzlib module for Lua) with maximum compression.  I used
	maximum compression because I figure take the hit on time for
	compression on more powerful machines to save space on less powerful
	machines one might embed Lua in.


--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia