lua-users home
lua-l archive

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


On Wed, Aug 31, 2011 at 12:50, Lorenzo Donati
<lorenzodonatibz@interfree.it> wrote:
> On 31/08/2011 10.17, Alexander Gladysh wrote:
>>
>> On Wed, Aug 31, 2011 at 11:03, Lorenzo Donati
>> <lorenzodonatibz@interfree.it>  wrote:

>>> According to the following benchmarks, built-in math.floor and math.ceil
>>> are
>>> slower than their counterpart rewritten using the core % operator!
>>
>> That is to be expected. C function call is relatively slow.

> Do you mean that floor and ceil are really slower?

C function calls are, when compared with VM instruction execution.

You may find this helpful:

http://www.lua.org/gems/sample.pdf

Also, read output of luac -l yourscript.lua

This doc may help with reading:
http://luaforge.net/docman/view.php/83/98/ANoFrillsIntroToLua51VMInstructions.pdf

Alexander.