lua-users home
lua-l archive

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


On Tue, Dec 29, 2009 at 10:48 PM, Javier Guerra <javier@guerrag.com> wrote:
> On Tue, Dec 29, 2009 at 5:39 PM, Venkat Murty <venkat_murty@yahoo.com> wrote:
>>
>>
>> /** The attached code prints out 202 lines with standard lua.
>>    And 103 lines with LuaJIT. (LuaJIT-2.0.0-beta2)
>>  */
>
>
> from the Lua manual definition of lua_sethook():
>
> The count hook: is called after the interpreter executes every count
> instructions. (This event only happens while Lua is executing a Lua
> function.)
>
> obviously, this is subject to the exact number of VM instructions.  a
> different compiler generates a different number of VM instructions.
> even more, LuaJIT uses a different VM bytecode than plain Lua, so you
> can't compare the number of instructions.
I initially thought the same, but the code only uses the hook to
periodically yield a coroutine, which shouldn't have any effect on the
number of lines of output.