mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Fixes: https://github.com/nodejs/node/issues/58892 Refs: https://github.com/nodejs/node/issues/52663 Signed-off-by: avivkeller <me@aviv.sh> PR-URL: https://github.com/nodejs/node/pull/65524 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
25 lines
559 B
JavaScript
25 lines
559 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [10],
|
|
dir: [ 'lib', 'test/parallel'],
|
|
withFileTypes: ['true', 'false'],
|
|
});
|
|
|
|
function main({ n, dir, withFileTypes }) {
|
|
withFileTypes = withFileTypes === 'true';
|
|
const fullPath = path.resolve(__dirname, '../../', dir);
|
|
bench.start();
|
|
(function r(cntr) {
|
|
if (cntr-- <= 0)
|
|
return bench.end(n);
|
|
fs.readdir(fullPath, { withFileTypes }, () => {
|
|
r(cntr);
|
|
});
|
|
}(n));
|
|
}
|