lua-users home
lua-l archive

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

Alex Queiroz <> writes:

> On Thu, Nov 18, 2010 at 11:17 AM, David Kastrup <> wrote:
>> Alex Queiroz <> writes:
>>>      Sometimes I wonder how plain Lua can be so fast sticking only to
>>> standard ANSI C. That's an achievement. For instance, the VM dispatch
>>> uses the C switch statement, which is known to be slow.
>> Huh?  Why would it be "known to be slow"?  Have you taken a look at the
>> kind of code it generates?
>      The standards-compliant switch statement must emit code to check
> interval range.

Not if the data type is covered exhaustively.

> This code kills the CPU predictor and causes severe pipeline flushing.

I have yet to see an alternative that can predict the opcodes.

David Kastrup