Skip to content

Commit e2ea13a

Browse files
committed
fixup! fs: improve error performance for fs.mkdtempSync
1 parent 476e8d4 commit e2ea13a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

benchmark/fs/bench-mkdtempSync.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,20 @@ function main({ n, type }) {
2828
bench.start();
2929
for (let i = 0; i < n; i++) {
3030
try {
31-
const folderPath = fs.mkdtempSync(prefix, { encoding: 'utf8' });
32-
fs.rmdirSync(folderPath);
31+
fs.mkdtempSync(`${prefix}-${i}`, { encoding: 'utf8' });
3332
} catch {
3433
// do nothing
3534
}
3635
}
3736
bench.end(n);
37+
38+
if (type === 'valid') {
39+
for (let i = 0; i < n; i++) {
40+
try {
41+
fs.rmdirSync(`${prefix}-${i}`);
42+
} catch {
43+
// do nothing
44+
}
45+
}
46+
}
3847
}

0 commit comments

Comments
 (0)