Skip to content

smelt.perf

Availability: Everywhere, including headless mode.

Advanced: Low-level building block for plugins that need full control. It may change more freely than the rest of the API.

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.