LavaUI docs

enum WidgetProfiler

Swift

enum WidgetProfiler

Per-widget paint cost, opt-in via LAVAUI_PROFILE=1.

Exists because tracking down a slow widget otherwise means manually wrapping suspects in FrameScheduler.now() calls, rebuilding, reading a log, and removing the probes again — which is exactly what it took to find that a 40,000-point chart, not the editor next to it, was the remaining cost after a large-file editor fix. This makes that the first thing you check, not the last.

Timed at widget granularity — one entry per leaf (a Canvas, an EditorView, a Button, …), not per draw primitive. Timing every rect/text/circle call individually would add far more overhead than the primitives themselves cost, swamping the very signal this exists to find; a widget's whole paint is the right unit; a Canvas doing something expensive internally still shows up as one number on one row.

Sources/LavaUI/WidgetProfiler.swift:18

Properties

static let isEnabled: Bool

Not documented.

Sources/LavaUI/WidgetProfiler.swift:19

Methods

static func snapshot() -> [(label: String, ms: Double, count: Int)]

Most recently completed frame's per-widget cost, worst first.

Sources/LavaUI/WidgetProfiler.swift:58