Skip to content

Commit

Permalink
fixup! fs: improve error perf of sync *times
Browse files Browse the repository at this point in the history
  • Loading branch information
CanadaHonk committed Sep 27, 2023
1 parent a491a51 commit b9701f6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions benchmark/fs/bench-timesSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ function main({ n, type, func }) {
const useFds = func === 'futimes';
const fsFunc = fs[func + 'Sync'];

const time = Date.now() / 1000;

switch (type) {
case 'existing': {
const files = [];
Expand All @@ -30,7 +28,7 @@ function main({ n, type, func }) {

bench.start();
for (let i = 0; i < n; i++) {
fsFunc(files[i], time, time);
fsFunc(files[i], i, i);
}
bench.end(n);

Expand All @@ -45,12 +43,10 @@ function main({ n, type, func }) {
break;
}
case 'non-existing': {
const file = useFds ? (1 << 30) : tmpdir.resolve(`.non-existing-file-${Date.now()}`);

bench.start();
for (let i = 0; i < n; i++) {
try {
fsFunc(file, time, time);
fsFunc(useFds ? (1 << 30) : tmpdir.resolve(`.non-existing-file-${Date.now()}`), i, i);
} catch {
// do nothing
}
Expand Down

0 comments on commit b9701f6

Please sign in to comment.