lua-users home
lua-l archive

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


On Thu, Nov 18, 2010 at 11:17 AM, David Kastrup <dak@gnu.org> wrote:
> Alex Queiroz <asandroq@gmail.com> 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. This code kills the CPU predictor and causes severe
pipeline flushing.

-- 
-alex
http://www.artisancoder.com/