lua-users home
lua-l archive

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


>From lua-l@tecgraf.puc-rio.br  Tue Aug  1 19:23:15 2000
>From: Steve Dekorte <steve@dekorte.com>
>
>I noticed that luac has a optimize option. 
>When I do a dofile() on a uncompiled lua file or dostring() on a string 
>in Lua, are they compiled optimized in the same way as luac -O? 

No. However, there's not much difference, because all that -O in luac 
rellay does is to compact string and floating point numbers tables in each
function. The bytecode remains the same (except that -O removes debug info).
Moreover, 4.0 contains a new code generator that generates very good code,
wiht several optimizations.

luac -O is mainly used for large metafiles, with many constants. The table
compaction that -O does is only needed because the parser does not expend
too much effort on trying not to repeat constants, and this affects only
large metafiles.
I'll probably remove -O from luac 4.0 and do it always.

So, bottom line, -O does not generate better bytecode at all, which is what
you seem to be worrying about.
--lhf