Skip to content

Commit dc8ce06

Browse files
committed
benchmark: updates to use the new setup and teardown options
1 parent 04fdda4 commit dc8ce06

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

benchmark/module/module-require.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,22 @@ const common = require('../common.js');
55
const tmpdir = require('../../test/common/tmpdir');
66
const benchmarkDirectory = tmpdir.resolve('nodejs-benchmark-module');
77

8+
const t = 1e4;
9+
810
const bench = common.createBenchmark(main, {
911
type: ['.js', '.json', 'dir'],
10-
n: [1e4],
12+
n: [t],
13+
}, {
14+
setup() {
15+
tmpdir.refresh();
16+
createEntryPoint(t);
17+
},
18+
teardown() {
19+
tmpdir.refresh();
20+
},
1121
});
1222

1323
function main({ type, n }) {
14-
tmpdir.refresh();
15-
createEntryPoint(n);
16-
1724
switch (type) {
1825
case '.js':
1926
measureJSFile(n);
@@ -24,8 +31,6 @@ function main({ type, n }) {
2431
case 'dir':
2532
measureDir(n);
2633
}
27-
28-
tmpdir.refresh();
2934
}
3035

3136
function measureJSFile(n) {

0 commit comments

Comments
 (0)