lua-users home
lua-l archive

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

On 27-Apr-05, at 10:05 AM, Luiz Henrique de Figueiredo wrote:

Peephole-optimisation might be a goer -- I assume there would be some
level of redundancy in the generated byte-code.  But this is really
something that could be applied to the lua.lib portion anyway I'd assume -- but considering it was stripped from lua5 because it was becoming to difficult to maintain?

Actually, all optimizations done by luac in 4.0 are done by the parser in 5.0.

The one little optimization which might make a fun project for someone is the common idiom:

  a and b or c

where b is a constant.

Currently, the compiler generates a redundant check on b (redundant if b is constant, anyway).

Of course an actual ternary operator could be optimised even better, since the intent was probably a ? b : c in the first place. But I'm not advocating that.