GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — benchmark: add warmup to accessSync bench · nodejs/node@2326971

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • benchmark/fs
    • bench-accessSync.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/fs/bench-accessSync.js‎

Copy file name to clipboardExpand all lines: benchmark/fs/bench-accessSync.js
+13-7Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ const bench = common.createBenchmark(main, {
1313
n: [1e5],
1414
});
1515

16+
function runBench(n, path) {
17+
for (let i = 0; i < n; i++) {
18+
try {
19+
fs.accessSync(path);
20+
} catch {
21+
// do nothing
22+
}
23+
}
24+
}
25+
1626
function main({ n, type }) {
1727
let path;
1828

@@ -29,14 +39,10 @@ function main({ n, type }) {
2939
default:
3040
new Error('Invalid type');
3141
}
42+
// warmup
43+
runBench(n, path);
3244

3345
bench.start();
34-
for (let i = 0; i < n; i++) {
35-
try {
36-
fs.accessSync(path);
37-
} catch {
38-
// do nothing
39-
}
40-
}
46+
runBench(n, path);
4147
bench.end(n);
4248
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.