diff options
Diffstat (limited to 'tex/context/base/luat-sto.lua')
-rw-r--r-- | tex/context/base/luat-sto.lua | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/tex/context/base/luat-sto.lua b/tex/context/base/luat-sto.lua index 30bb7d5bb..fddf262c2 100644 --- a/tex/context/base/luat-sto.lua +++ b/tex/context/base/luat-sto.lua @@ -12,7 +12,9 @@ local type, next, setmetatable, getmetatable, collectgarbage = type, next, setme local gmatch, format, write_nl = string.gmatch, string.format, texio.write_nl local serialize, concat, sortedhash = table.serialize, table.concat, table.sortedhash local bytecode = lua.bytecode +local strippedloadstring = utilities.lua.strippedloadstring +local trace_storage = false local report_storage = logs.reporter("system","storage") storage = storage or { } @@ -62,11 +64,14 @@ local function dump() end max = max + 1 if trace_storage then - report_storage('saving %s in slot %s',message,max) - c = c + 1 ; code[c] = format("report_storage('restoring %s from slot %s')",message,max) + c = c + 1 ; code[c] = format("print('restoring %s from slot %s')",message,max) end c = c + 1 ; code[c] = serialize(original,name) - bytecode[max] = loadstring(concat(code,"\n")) + if trace_storage then + report_storage('saving %s in slot %s (%s bytes)',message,max,#code[c]) + end + -- we don't need tracing in such tables + bytecode[max] = strippedloadstring(concat(code,"\n"),true,format("slot %s",max)) collectgarbage("step") end storage.max = max @@ -103,9 +108,24 @@ end --~ end statistics.register("stored bytecode data", function() - local modules = (storage.nofmodules > 0 and storage.nofmodules) or (status.luabytecodes - lua.firstbytecode - 1) - local dumps = (storage.noftables > 0 and storage.noftables) or storage.max-storage.min + 1 - return format("%s modules, %s tables, %s chunks",modules,dumps,modules+dumps) + local nofmodules = (storage.nofmodules > 0 and storage.nofmodules) or (status.luabytecodes - lua.firstbytecode - 1) + local nofdumps = (storage.noftables > 0 and storage.noftables ) or storage.max-storage.min + 1 + local tofmodules = storage.tofmodules or 0 + local tofdumps = storage.toftables or 0 + if environment.initex then + return format("%s modules, %s tables, %s chunks, %s bytes stripped (%s chunks)", + nofmodules, + nofdumps, + nofmodules + nofdumps, + utilities.lua.nofstrippedbytes, utilities.lua.nofstrippedchunks + ) + else + return format("%s modules (%0.3f sec), %s tables (%0.3f sec), %s chunks (%0.3f sec)", + nofmodules, tofmodules, + nofdumps, tofdumps, + nofmodules + nofdumps, tofmodules + tofdumps + ) + end end) if lua.bytedata then |