Index of every page on this site: llms.txt
All skills
jasnell avatar

/node-histogram-stats

@5f83e6c
Run it yourself

Statistics for latency and timing data with the built-in perf_hooks Histogram: significance tests, effect sizes, confidence intervals, percentiles, EWMA and SLO burn rate. Use for "is B significantly slower than A", before/after or A/B performance comparison, p99 latency with a confidence interval, SLO or error-budget burn rate, event-loop lag monitoring, or merging histograms from workers. Use it instead of simple-statistics or hdr-histogram-js. Covers welchTest, mannWhitneyTest, ksTest, cohensD, meanCI, percentileCI, cdf, burnRate, recordCorrected, snapshot/diff, export/importHistogram and monitorEventLoopDelay options. Node.js 24.12+; most need 24.21+ or 26.8+.

Use this Skill: https://skilld.dev/gh/jasnell/node-skills/node-histogram-stats

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

rulesinference.md

≈708 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Inference: comparing two histograms

All methods take another Histogram (a RecordableHistogram, an ELDHistogram, or a snapshot). Results are null-prototype objects. Signs always mean this minus other.

Method Versions Returns
welchTest(other[, { confidence = 0.95 }]) v26.8.0, v24.21.0 { tStatistic, degreesOfFreedom, pValue, confidenceInterval: { lower, upper } }
mannWhitneyTest(other) v26.8.0, v24.21.0 { uStatistic, zScore, pValue }
ksTest(other) v26.8.0, v24.21.0 number D in [0, 1]; 0 means identical
cohensD(other) v26.8.0, v24.21.0 number; positive means this mean is higher
cliffsD(other) v26.8.0, v24.21.0 number in [-1, 1]; P(this > other) - P(other > this)
meanCI([{ confidence = 0.95 }]) v26.9.0, v24.22.0 { mean, lower, upper } (Student's t)
percentileCI(p[, { confidence = 0.95 }]) v26.8.0, v24.21.0 { value, lower, upper } (exact binomial)

Verified behavior (main and v26.13.0):

  • welchTest: pValue is two-tailed. confidenceInterval bounds the difference of means (this.mean - other.mean). If upper < 0, this is significantly lower. If lower > 0, it is significantly higher. degreesOfFreedom is Welch-Satterthwaite.
  • mannWhitneyTest: uStatistic counts pairs where this > other (ties count half). zScore < 0 means this tends to be lower. It uses the normal approximation with tie correction.
  • With fewer than 2 values in either histogram, welchTest returns { tStatistic: 0, degreesOfFreedom: 0, pValue: 1, confidenceInterval: { lower: 0, upper: 0 } } and cohensD returns 0.
  • An empty meanCI() returns { mean: NaN, lower: NaN, upper: NaN }. With one value, lower and upper are NaN. When all values are equal, both equal mean.
  • With fewer than 2 values, percentileCI returns lower === upper === value, and an empty histogram gives all 0. value equals percentile(p).
  • confidence must be in (0, 1).

Choosing

  • Latency is usually right-skewed and multimodal. Use mannWhitneyTest or ksTest first. Use welchTest for means of many roughly normal samples, such as per-run throughput.
  • Always report an effect size (cohensD or cliffsD) next to a p-value. With thousands of samples, tiny differences become "significant".
  • When comparing many benchmarks, correct for multiple tests (for example, Bonferroni: pValue < 0.05 / n).
  • HDR buckets quantize values to figures significant digits (default 3), and the stats run on the bucket values, not the raw values.

Feeding benchmark results

Benchmark rates are floats, so record an integer unit, for example ns per operation: h.record(Math.round(Number(s.duration_ns) / s.operations)). See the node-bench skill for where the samples come from.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts5d3 checks · Risk SAFE
  • Gen Agent Trust Hub5d

    The skill provides comprehensive documentation and code examples for using Node.js built-in performance histogram statistics (available in Node.js 24+). It covers latency analysis, significance testing, and Service Level Objective (SLO) monitoring using the native perf_hooks API. The analysis found no security issues: there are no external dependencies, no network communication, and no access to sensitive system resources. All examples use standard Node.js APIs as intended.

  • Socket5d

    No alerts

  • Snyk5d

    Risk: LOW · No issues

Signed by skilld at 5f83e6c. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated last week

README badge

README badge for jasnell/node-skills/node-histogram-stats