[luatex] Profiling LuaTeX / difference with jit
Patrick Gundlach
patrick at gundla.ch
Sat Mar 11 18:04:23 CET 2017
Hi all,
I try to understand Lua's debug library and came across differences between luatex and luajittex.
See the following program:
------------
function a(cp)
return string.format("abc %d",cp)
end
function dothings()
a(2)
a(2)
end
function onDebugHook( hookType )
local funcInfo = debug.getinfo( 2 )
if hookType == "call" then
print("call",funcInfo.name or "?")
elseif hookType == "return" then
print("return",funcInfo.name or "?")
end
end
debug.sethook( onDebugHook, 'cr')
dothings()
--------------
with "luatex --luaonly main.lua" I get a balanced call/return list:
--------------
return sethook
call dothings
call a
call format
return format
return a
call a
call format
return format
return a
return dothings
return ?
--------------
with "luajittex --luaonly main.lua" I get
--------------
call dothings
call a
call a
call a
call a
return dothings
return ?
--------------
I guess this has to do with optimizations that Luajittex does.
Just out of curiosity (I can of course work with regular LuaTeX) Now let's say I want to have the output from LuaTeX with the LuajitTeX program, (how) is this possible?
Patrick
More information about the luatex
mailing list