MCPcopy Create free account
hub / github.com/nodejs/node / main

Function main

benchmark/fs/bench-rmdirSync.js:13–42  ·  view source on GitHub ↗
({ n, type })

Source from the content-addressed store, hash-verified

11});
12
13function main({ n, type }) {
14 switch (type) {
15 case 'existing': {
16 for (let i = 0; i < n; i++) {
17 fs.mkdirSync(tmpdir.resolve(`rmdirsync-bench-dir-${i}`));
18 }
19
20 bench.start();
21 for (let i = 0; i < n; i++) {
22 fs.rmdirSync(tmpdir.resolve(`rmdirsync-bench-dir-${i}`));
23 }
24 bench.end(n);
25 break;
26 }
27 case 'non-existing': {
28 bench.start();
29 for (let i = 0; i < n; i++) {
30 try {
31 fs.rmdirSync(tmpdir.resolve(`.non-existent-folder-${i}`));
32 } catch {
33 // do nothing
34 }
35 }
36 bench.end(n);
37 break;
38 }
39 default:
40 new Error('Invalid type');
41 }
42}

Callers

nothing calls this directly

Calls 5

mkdirSyncMethod · 0.45
resolveMethod · 0.45
startMethod · 0.45
rmdirSyncMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected