Skip to content

st.debug — Performance Profiling ​

lua
-- Inline timing: runs cb and prints elapsed microseconds
local result = st.debug.perfomance('MyOperation', function()
    -- expensive work
    return someValue
end)

-- Deferred timing (for async operations)
local id = st.debug.performanceStart('MyAsyncOp')
-- ... do work ...
local elapsed = st.debug.performanceStop(id)  -- prints and returns μs