PerformanceStats
A snapshot of runtime counters and the currently collected timing samples.
Example
Section titled “Example”Where to put it: replace Src/Main.luau in a project created with this SDK. This is the complete entry file.
local Window = Instance.new("Window", { Title = "LUI example", Size = UDim2.fromOffset(560, 280),})local Status = Instance.new("TextLabel", { Parent = Window, Text = "Ready", Position = UDim2.fromOffset(16, 170), Size = UDim2.new(1, -32, 0, 72),})local Performance = app:GetService("PerformanceService")local Start = Performance:GetTime()task.delay(0.1, function() local Stats = Performance:GetStats() Status.Text = "Elapsed ms: " .. math.floor(Performance:GetTime() - Start) .. "; live Instances: " .. Stats.LiveInstancesend)Window.Visible = trueExpected result: Displays elapsed milliseconds and a runtime counter. The delay is scheduled work, not a precise real-time timer.
Properties
Section titled “Properties”LiveInstances
Section titled “LiveInstances”Currently live Instances.
Type: number. Read-only.
RetainedInstances
Section titled “RetainedInstances”Instances still retained by the runtime, which can include objects awaiting release.
Type: number. Read-only.
Connections
Section titled “Connections”Currently retained signal connections.
Type: number. Read-only.
LuaMemoryBytes
Section titled “LuaMemoryBytes”Memory attributed to the Luau VM, in bytes; this is not whole-process memory.
Type: number. Read-only.
QueuedEvents
Section titled “QueuedEvents”Number of events waiting for delivery.
Type: number. Read-only.
QueuedBytes
Section titled “QueuedBytes”Bytes charged to queued runtime data.
Type: number. Read-only.
LayoutPasses
Section titled “LayoutPasses”Accumulated shared layout passes.
Type: number. Read-only.
PresentationCalls
Section titled “PresentationCalls”Accumulated native presentation submissions, not visible display frames.
Type: number. Read-only.
LayoutSamples
Section titled “LayoutSamples”Number of layout timing samples collected.
Type: number. Read-only.
LayoutP95Ms
Section titled “LayoutP95Ms”95th-percentile layout time in milliseconds: 95% of collected samples were at or below this value.
Type: number. Read-only.
LastLayoutMs
Section titled “LastLayoutMs”Duration of the most recent measured layout pass in milliseconds.
Type: number. Read-only.
IsHeadless
Section titled “IsHeadless”Whether this runtime runs without a native display backend.
Type: boolean. Read-only.
InputSamples
Section titled “InputSamples”Number of measured input-response samples.
Type: number. Read-only.
InputP95Ms
Section titled “InputP95Ms”95th-percentile measured input-response time in milliseconds, excluding physical input/display latency.
Type: number. Read-only.
InputP99Ms
Section titled “InputP99Ms”99th-percentile measured input-response time in milliseconds.
Type: number. Read-only.
RenderSamples
Section titled “RenderSamples”Number of measured native render-submission samples.
Type: number. Read-only.
RenderP95Ms
Section titled “RenderP95Ms”95th-percentile native render-submission time in milliseconds; not physical scanout.
Type: number. Read-only.
RenderP99Ms
Section titled “RenderP99Ms”99th-percentile native render-submission time in milliseconds.
Type: number. Read-only.
Full type declaration — for type checking and deeper reference
The declaration is generated from the SDK. Self is supplied by a colon call; read means the field cannot be assigned. See how to read this reference.
export type PerformanceStats = { read LiveInstances: number, read RetainedInstances: number, read Connections: number, read LuaMemoryBytes: number, read QueuedEvents: number, read QueuedBytes: number, read LayoutPasses: number, read PresentationCalls: number, read LayoutSamples: number, read LayoutP95Ms: number, read LastLayoutMs: number, read IsHeadless: boolean, read InputSamples: number, read InputP95Ms: number, read InputP99Ms: number, read RenderSamples: number, read RenderP95Ms: number, read RenderP99Ms: number,}Availability and deeper reading
Section titled “Availability and deeper reading”See platform limits before relying on host-specific behavior. The framework design specification and reflection/type sources are deeper engineering references, not extra setup required to build an app.