Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
benchmark: add trailing commas in benchmark/module
PR-URL: #46461
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 committed Feb 3, 2023
commit 279839dc433e1b7b4f6176feea091c4cf4e688e7
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,
);
}
}