/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
benchmark/perf_hooks/histogram-record.js
26 строк
560 B
James M Snell
src: add fast api for Histogram
29 дек 2023, 19:40
Не верифицирован
29 дек 2023, 19:40
1a49193
Код
Авторство
О чём код?
'use strict'; const assert = require('assert'); const common = require('../common.js'); const { createHistogram } = require('perf_hooks'); const bench = common.createBenchmark(main, { n: [1e5], }); function main({ n }) { const histogram = createHistogram(); bench.start(); for (let i = 0; i < n; i++) { histogram.record(i + 1); /* eslint-disable no-unused-expressions */ histogram.max; histogram.mean; /* eslint-enable no-unused-expressions */ } bench.end(n); // Avoid V8 deadcode (elimination) assert.ok(histogram); }