Skip to content

Commit 93ee36e

Browse files
RafaelGSStargos
authored andcommitted
benchmark: rename count to n
It's a common approach to use n as number of iterations over the benchmark. Changing it from count to n will also make ./node benchmark/run.js --set n=X more meaningful among other benchmarks PR-URL: #54271 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 6a4f05e commit 93ee36e

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎benchmark/misc/startup-cli-version.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const availableCli = [
1818
].filter((cli)=>existsSync(path.resolve(__dirname,'../../',cli)));
1919
constbench=common.createBenchmark(main,{
2020
cli: availableCli,
21-
count: [30],
21+
n: [30],
2222
});
2323

2424
functionspawnProcess(cli,bench,state){
2525
constcmd=process.execPath||process.argv[0];
26-
while(state.finished<state.count){
26+
while(state.finished<state.n){
2727
constchild=spawnSync(cmd,[cli,'--version'],{
2828
env: {npm_config_loglevel: 'silent', ...process.env},
2929
});
@@ -41,15 +41,15 @@ function spawnProcess(cli, bench, state) {
4141
bench.start();
4242
}
4343

44-
if(state.finished===state.count){
45-
bench.end(state.count);
44+
if(state.finished===state.n){
45+
bench.end(state.n);
4646
}
4747
}
4848
}
4949

50-
functionmain({count, cli }){
50+
functionmain({n, cli }){
5151
cli=path.resolve(__dirname,'../../',cli);
5252
constwarmup=3;
53-
conststate={count,finished: -warmup};
53+
conststate={n,finished: -warmup};
5454
spawnProcess(cli,bench,state);
5555
}

‎benchmark/misc/startup-core.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const bench = common.createBenchmark(main, {
1111
'test/fixtures/semicolon',
1212
],
1313
mode: ['process','worker'],
14-
count: [30],
14+
n: [30],
1515
});
1616

1717
functionspawnProcess(script,bench,state){
1818
constcmd=process.execPath||process.argv[0];
19-
while(state.finished<state.count){
19+
while(state.finished<state.n){
2020
constchild=spawnSync(cmd,[script]);
2121
if(child.status!==0){
2222
console.log('---- STDOUT ----');
@@ -31,8 +31,8 @@ function spawnProcess(script, bench, state) {
3131
bench.start();
3232
}
3333

34-
if(state.finished===state.count){
35-
bench.end(state.count);
34+
if(state.finished===state.n){
35+
bench.end(state.n);
3636
}
3737
}
3838
}
@@ -48,18 +48,18 @@ function spawnWorker(script, bench, state) {
4848
// Finished warmup.
4949
bench.start();
5050
}
51-
if(state.finished<state.count){
51+
if(state.finished<state.n){
5252
spawnWorker(script,bench,state);
5353
}else{
54-
bench.end(state.count);
54+
bench.end(state.n);
5555
}
5656
});
5757
}
5858

59-
functionmain({count, script, mode }){
59+
functionmain({n, script, mode }){
6060
script=path.resolve(__dirname,'../../',`${script}.js`);
6161
constwarmup=3;
62-
conststate={count,finished: -warmup};
62+
conststate={n,finished: -warmup};
6363
if(mode==='worker'){
6464
Worker=require('worker_threads').Worker;
6565
spawnWorker(script,bench,state);

0 commit comments

Comments
 (0)