lua-users home
lua-l archive

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


Pico Gamo wrote:
> Is there any way to confirm that I actually am using LuaJIT

-- Should print 'true' etc. if the JIT is on.
print(jit.status())

-- The following loop should take only a fraction of a second with LuaJIT.
-- With the standard Lua interpreter it takes more than a minute!
local x=0; for i=1,1e9 do x=math.abs(x) end

> but it simply hasn't made any noticeable improvement in execution?

Before even thinking about switching to LuaJIT, you should profile
your application and find out what percentage of CPU time is spent
in C/C++ code vs. the time spent in the Lua interpreter. If the
time spent in Lua is negligible, there's no gain to be expected.

Also have a look at the number of Lua->C and C->Lua calls via the
classic Lua/C API. These are expensive and neither a C compiler,
nor a Lua compiler can optimize across the language border. Most
of the time will be wasted in the API calls.

--Mike