lua-users home
lua-l archive

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


On Thu, Sep 28, 2006 at 10:46:58PM +0000, David Given wrote:
> arg = "5"
> print (arg+0)
> 
> Likewise, some compiler sugar to convert to treat '+a' as '0+a' would be
> easy, not involve any additional opcodes, and would optimise away to
> nothing in most cases.

echo 'for i = 1,10000000 do local a = 5*(i); end' | time luac -l -
echo 'for i = 1,10000000 do local a = 5*(0+i); end' | time luac -l -

Lua's compiler doesn't do much (any?) optimization.

-- 
Glenn Maynard