Skip to content

Commit

Permalink
benchmark: add trailing commas in benchmark/module
Browse files Browse the repository at this point in the history
PR-URL: #46461
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
aduh95 authored and MylesBorins committed Feb 18, 2023
1 parent 7760d40 commit 897e3c2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion benchmark/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ overrides:
- http/*.js
- http2/*.js
- misc/*.js
- module/*.js
- path/*.js
- process/*.js
- url/*.js
Expand Down
2 changes: 1 addition & 1 deletion benchmark/module/module-loader-circular.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const benchmarkDirectory =
path.resolve(tmpdir.path, 'benchmark-module-circular');

const bench = common.createBenchmark(main, {
n: [1e4]
n: [1e4],
});

function main({ n }) {
Expand Down
8 changes: 4 additions & 4 deletions benchmark/module/module-loader-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ const benchmarkDirectory = path.join(tmpdir.path, 'nodejs-benchmark-module');
const bench = common.createBenchmark(main, {
ext: ['', '.js'],
files: [1e3],
cache: ['true', 'false']
cache: ['true', 'false'],
});

function main({ ext, cache, files }) {
tmpdir.refresh();
fs.mkdirSync(benchmarkDirectory);
fs.writeFileSync(
`${benchmarkDirectory}/a.js`,
'module.exports = {};'
'module.exports = {};',
);
for (let i = 0; i <= files; i++) {
fs.mkdirSync(`${benchmarkDirectory}/${i}`);
fs.writeFileSync(
`${benchmarkDirectory}/${i}/package.json`,
'{"main": "index.js"}'
'{"main": "index.js"}',
);
fs.writeFileSync(
`${benchmarkDirectory}/${i}/index.js`,
`require('../a${ext}');`
`require('../a${ext}');`,
);
}

Expand Down
6 changes: 3 additions & 3 deletions benchmark/module/module-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const bench = common.createBenchmark(main, {
dir: ['rel', 'abs'],
files: [5e2],
n: [1, 1e3],
cache: ['true', 'false']
cache: ['true', 'false'],
});

function main({ n, name, cache, files, dir }) {
Expand All @@ -25,11 +25,11 @@ function main({ n, name, cache, files, dir }) {
fs.mkdirSync(`${benchmarkDirectory}${i}`);
fs.writeFileSync(
`${benchmarkDirectory}${i}/package.json`,
'{"main": "index.js"}'
'{"main": "index.js"}',
);
fs.writeFileSync(
`${benchmarkDirectory}${i}/index.js`,
'module.exports = "";'
'module.exports = "";',
);
}

Expand Down
4 changes: 2 additions & 2 deletions benchmark/module/module-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ function createEntryPoint(n) {
fs.mkdirSync(`${benchmarkDirectory}${i}`);
fs.writeFileSync(
`${benchmarkDirectory}${i}/package.json`,
'{"main": "index.js"}'
'{"main": "index.js"}',
);
fs.writeFileSync(
`${benchmarkDirectory}${i}/index.js`,
JSFileContent
JSFileContent,
);
}
}

0 comments on commit 897e3c2

Please sign in to comment.