0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-22 07:37:56 +01:00
nodejs/benchmark/diagnostics_channel/subscribe.js
Stephen Belanger c6c36c3da7 lib: create diagnostics_channel module
PR-URL: https://github.com/nodejs/node/pull/34895
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2020-10-31 21:24:11 +00:00

20 lines
347 B
JavaScript

'use strict';
const common = require('../common.js');
const dc = require('diagnostics_channel');
const bench = common.createBenchmark(main, {
n: [1e8],
});
function noop() {}
function main({ n }) {
const channel = dc.channel('channel.0');
bench.start();
for (let i = 0; i < n; i++) {
channel.subscribe(noop);
}
bench.end(n);
}