Skip to content

smelt.perf

Tier: Host - Available in every runtime, including headless mode.

Visibility: Public - Stable Lua API intended for user config and plugins.

Lightweight scope timers that feed smelt.metrics.perf_snapshot. Wrap a hot Lua block to see where time goes when perf collection is enabled.

smelt.perf.time

fun(label: string, fn: fun(): any): any

Run fn() and record its elapsed time under label. Returns whatever fn returns (single value). Cheap when perf collection is disabled.