Skip to content

Performance

Measured on an Intel Core i5-11300H @ 3.10 GHz.

BenchmarkLatency per callAllocations
RollingPercentile.Update()~65 ns0 allocs / 0 B
Execute(), Closed (full pipeline)~656 ns0 allocs / 0 B
Execute(), Open (fast reject)~57 ns0 allocs / 0 B

n is Config.WindowSize (100 by default).

ComponentTimeSpace
EWMA updateO(1)O(1)
Rolling percentile updateO(n)O(n), zero allocation
Rolling percentile readO(1)O(1)
Threshold calculationO(1)O(1)
Execute() total overheadO(n) per callO(n)

The O(n) update is a single in-place pass over a small fixed window, which is why the full pipeline stays below a microsecond.

The library ships Go benchmarks:

Terminal window
go test -bench . -benchmem ./...

The evaluation additionally measures container CPU and memory under load for two hardware profiles; see Metrics.