mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 22:28:51 +02:00

PR-URL: https://github.com/nodejs/node/pull/53612 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
23 lines
597 B
JavaScript
23 lines
597 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 = { force: true, 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);
|
|
}
|