lua-users home
lua-l archive

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


On Jun 18, 2014, at 11:06 AM, Sean Conner <sean@conman.org> wrote:

> It was thus said that the Great Paige DePol once stated:
>> On Jun 18, 2014, at 8:52 AM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
>> 
>>> Here is another example. It's a graphics metafile for drawing the official
>>> map of NYC subway converted from PDF. It has 165000 lines and lots of
>>> different numbers. Here are the sizes in bytes:
>>> 
>>> source     6858481
>>> binary    12115217      (1.77 of source)
>>> stripped   6633947      (0.97 of source)
>> 
>> Well, given that example I think I am justified in saying that having a
>> stripped binary be larger than the original source is probably a rare
>> occurrence! :)
> 
>  Not all that rare.  From my previous example, I did stripped versions, and
> on a 32-bit system:
> 
> -rw-r--r--  1 spc spc  5972 Jun 18 11:28 IS41.lua
> -rw-r--r--  1 spc spc  7009 Jun 18 11:28 IS41.o
> -rw-r--r--  1 spc spc  5567 Jun 18 11:50 IS41s.o
> -rw-r--r--  1 spc spc  1687 Jun 18 11:28 enum.lua
> -rw-r--r--  1 spc spc  2310 Jun 18 11:29 enum.o
> -rw-r--r--  1 spc spc  1729 Jun 18 11:50 enums.o
> -rw-r--r--  1 spc spc  1250 Jun 18 11:28 person.lua
> -rw-r--r--  1 spc spc  1932 Jun 18 11:29 person.o
> -rw-r--r--  1 spc spc  1181 Jun 18 11:50 persons.o
> -rw-r--r--  1 spc spc  5709 Jun 18 11:28 phone.lua
> -rw-r--r--  1 spc spc  5450 Jun 18 11:29 phone.o
> -rw-r--r--  1 spc spc  2755 Jun 18 11:50 phones.o
> -rw-r--r--  1 spc spc 21440 Jun 18 11:28 picture.lua
> -rw-r--r--  1 spc spc  8526 Jun 18 11:29 picture.o
> -rw-r--r--  1 spc spc  6867 Jun 18 11:50 pictures.o
> -rw-r--r--  1 spc spc  3296 Jun 18 11:28 testbed.lua
> -rw-r--r--  1 spc spc  4789 Jun 18 11:29 testbed.o
> -rw-r--r--  1 spc spc  3228 Jun 18 11:50 testbeds.o
> -rw-r--r--  1 spc spc   986 Jun 18 11:28 util.lua
> -rw-r--r--  1 spc spc  1709 Jun 18 11:29 util.o
> -rw-r--r--  1 spc spc   932 Jun 18 11:50 utils.o
> 
> The compiled-stripped version of enum.lua (enums.o) is larger than the
> original source, but for the rest, they're marginally smaller.  Now, on to
> the 64-bit versions:
> 
> -rw-r--r-- 1 spc spc  5972 2014-06-18 11:34 IS41.lua
> -rw-r--r-- 1 spc spc  7721 2014-06-18 11:34 IS41.o
> -rw-r--r-- 1 spc spc  6279 2014-06-18 11:56 IS41s.o
> -rw-r--r-- 1 spc spc  1687 2014-06-18 11:34 enum.lua
> -rw-r--r-- 1 spc spc  2550 2014-06-18 11:34 enum.o
> -rw-r--r-- 1 spc spc  1925 2014-06-18 11:56 enums.o
> -rw-r--r-- 1 spc spc  1250 2014-06-18 11:34 person.lua
> -rw-r--r-- 1 spc spc  2176 2014-06-18 11:34 person.o
> -rw-r--r-- 1 spc spc  1373 2014-06-18 11:56 persons.o
> -rw-r--r-- 1 spc spc  5709 2014-06-18 11:34 phone.lua
> -rw-r--r-- 1 spc spc  6058 2014-06-18 11:34 phone.o
> -rw-r--r-- 1 spc spc  3039 2014-06-18 11:57 phones.o
> -rw-r--r-- 1 spc spc 21440 2014-06-18 11:34 picture.lua
> -rw-r--r-- 1 spc spc  8914 2014-06-18 11:34 picture.o
> -rw-r--r-- 1 spc spc  7107 2014-06-18 11:57 pictures.o
> -rw-r--r-- 1 spc spc  3296 2014-06-18 11:34 testbed.lua
> -rw-r--r-- 1 spc spc  5425 2014-06-18 11:34 testbed.o
> -rw-r--r-- 1 spc spc  3728 2014-06-18 11:57 testbeds.o
> -rw-r--r-- 1 spc spc   986 2014-06-18 11:34 util.lua
> -rw-r--r-- 1 spc spc  1933 2014-06-18 11:35 util.o
> -rw-r--r-- 1 spc spc  1072 2014-06-18 11:57 utils.o
> 
>  There, both compiler versions are larger, athough the stripped versions
> are only a bit larger.  
> 
>  -spc (So, again, it comes down to measuring ... )

Thank you for posting those comparisons, it was very enlightening! 

I guess it likely comes down to the number of unique constants being used, also I suspect that larger source files have more chance to become smaller than files that are only a few kilobytes in size... also the whole 32/64-bit thing obviously make a difference as well.

That said, I can still see the utility of pre-compiling scripts and removing the parser from the Lua core on restricted hardware! :)

~pmd