Skip to content

Commit 4caaeb4

Browse files
RafaelGSSruyadorno
authored andcommitted
benchmark: add nodeTiming.uvmetricsinfo bench
PR-URL: #55614 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
1 parent e14fb2d commit 4caaeb4

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
3+
const common = require('../common.js');
4+
const assert = require('node:assert');
5+
const fs = require('node:fs/promises');
6+
7+
const {
8+
performance,
9+
} = require('perf_hooks');
10+
11+
const bench = common.createBenchmark(main, {
12+
n: [1e6],
13+
events: [1, 1000, 10000],
14+
});
15+
16+
async function runEvents(events) {
17+
for (let i = 0; i < events; ++i) {
18+
assert.ok(await fs.statfs(__filename));
19+
}
20+
}
21+
22+
async function main({ n, events }) {
23+
await runEvents(events);
24+
bench.start();
25+
for (let i = 0; i < n; i++) {
26+
assert.ok(performance.nodeTiming.uvMetricsInfo);
27+
}
28+
bench.end(n);
29+
}

0 commit comments

Comments
 (0)