[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua idiom: iteration with skips?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 20 Apr 2006 08:10:37 -0300
> (Just out of interest, is the byte-code compiler intelligent enough to
> optimise 'while true do'... into a noop? Because it's a very common idiom.)
Definitely. See for yourself with
echo 'while true do end' | luac -l -p -
This will print
1 [1] JMP -1 ; to 1
2 [1] RETURN 0 1
Note that there is just a jump instruction, no test.
The code generator does several other optimizations like that.
--lhf