Skip to content

Commit bc7ce6b

Browse files
committed
docs(bench_latency): correct max-vs-heap-head comment
The previous wording called `percentile(1.0)` "the top-K head", which is misleading for a min-heap implementation: `topKHeap[0]` is the SMALLEST element in the top-K (the admission threshold for new outliers), not the largest. The implementation snapshots the heap into a sequence, sorts it, and returns `topk[^1]` — the maximum. Comment-only change; behaviour unchanged.
1 parent 9703a56 commit bc7ce6b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

benchmarks/nim/bench_latency.nim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ proc runVariant(
154154
# (Task 6.2) sits well above the 100-sample p999 tail at the default
155155
# MessageCount and reserves headroom for larger MessageCount overrides
156156
# before p999 spills into the rescaled-reservoir stratum. max is
157-
# `percentile(1.0)`, always the top-K head.
157+
# `percentile(1.0)`, which after sorting the snapshotted top-K returns
158+
# `topk[^1]` (the largest element). This is NOT the heap head: the
159+
# min-heap's root (`topKHeap[0]`) is the SMALLEST of the top-K, the
160+
# admission threshold for new outliers, not the maximum sample seen.
158161
em.addMeasure(slug, "latency_p999_ns", metrics.p999_ns)
159162
em.addMeasure(slug, "latency_max_ns", metrics.max_ns)
160163

0 commit comments

Comments
 (0)