lua-users home
lua-l archive

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


David Given wrote:

> I suspect that lstrip would do better.

I wrote a whole thing about how this wouldn't work, because
Lua bytecode already doesn't include whitespace and
comments, then I realized that of course you meant lstrip
instead of, not in addition to, bytecode compilation.

A bit of quick-and-dirty experimentation (very small sample
size) suggests that lstrip crunches very small files much
better than luac -s, but does only slightly better with
medium to large files.

~> wc -c somefile.lua
     68 somefile.lua
~> luac -s somefile.lua && wc -c luac.out
    174 luac.out
~> lstrip < somefile.lua | wc -c
     56

~> wc -c somefile2.lua
  95136 somefile2.lua
~> luac -s somefile2.lua && wc -c luac.out
  38574 luac.out
~> lstrip < somefile2.lua | wc -c
  37362

~> wc -c somefile3.lua
 215027 somefile3.lua
~> luac -s somefile3.lua && wc -c luac.out
 132910 luac.out
~> lstrip < somefile3.lua | wc -c
 132010

-- 
Aaron