mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
e1e7a417da
PR-URL: https://github.com/nodejs/node/pull/54203 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
24 lines
584 B
JavaScript
24 lines
584 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const tmpdir = require('../../test/common/tmpdir');
|
|
tmpdir.refresh();
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [1, 100, 10_000],
|
|
});
|
|
|
|
function main({ n }) {
|
|
tmpdir.refresh();
|
|
const options = { recursive: true };
|
|
const src = path.join(__dirname, '../../test/fixtures/copy');
|
|
const dest = tmpdir.resolve(`${process.pid}/subdir/cp-bench-${process.pid}`);
|
|
bench.start();
|
|
for (let i = 0; i < n; i++) {
|
|
fs.cpSync(src, dest, options);
|
|
}
|
|
bench.end(n);
|
|
}
|