Skip to content

Commit

Permalink
fixup! fs: improve error performance of linkSync
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Oct 1, 2023
1 parent af44ab8 commit c437b20
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions benchmark/fs/bench-linkSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ const tmpdir = require('../../test/common/tmpdir');
tmpdir.refresh();

const tmpfile = tmpdir.resolve('.bench-file-data');
fs.writeFileSync(tmpfile, 'bench-file', 'utf-8');
fs.chmodSync(tmpfile, fs.constants.S_IRUSR);

// Calling `chmodSync` causes Windows build to fail.
// Reference: https://github.com/libuv/libuv/issues/3267
if (process.platform !== 'win32') {
fs.writeFileSync(tmpfile, 'bench-file', 'utf-8');
fs.chmodSync(tmpfile, fs.constants.S_IRUSR);
}

const bench = common.createBenchmark(main, {
type: ['valid', 'invalid'],
n: [1e3],
}, {
combinationFilter() {
return process.platform !== 'win32';
},
});

function main({ n, type }) {
Expand Down

0 comments on commit c437b20

Please sign in to comment.