| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1535469 commit c166036
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,12 +18,12 @@ const availableCli = [ | |||
| 18 | 18 | ].filter((cli) => existsSync(path.resolve(__dirname, '../../', cli))); | |
| 19 | 19 | const bench = common.createBenchmark(main, { | |
| 20 | 20 | cli: availableCli, | |
| 21 | - count: [30], | ||
| 21 | + n: [30], | ||
| 22 | 22 | }); | |
| 23 | 23 | ||
| 24 | 24 | function spawnProcess(cli, bench, state) { | |
| 25 | 25 | const cmd = process.execPath || process.argv[0]; | |
| 26 | - while (state.finished < state.count) { | ||
| 26 | + while (state.finished < state.n) { | ||
| 27 | 27 | const child = spawnSync(cmd, [cli, '--version'], { | |
| 28 | 28 | env: { npm_config_loglevel: 'silent', ...process.env }, | |
| 29 | 29 | }); | |
@@ -41,15 +41,15 @@ function spawnProcess(cli, bench, state) { | |||
| 41 | 41 | bench.start(); | |
| 42 | 42 | } | |
| 43 | 43 | ||
| 44 | - if (state.finished === state.count) { | ||
| 45 | - bench.end(state.count); | ||
| 44 | + if (state.finished === state.n) { | ||
| 45 | + bench.end(state.n); | ||
| 46 | 46 | } | |
| 47 | 47 | } | |
| 48 | 48 | } | |
| 49 | 49 | ||
| 50 | - function main({ count, cli }) { | ||
| 50 | + function main({ n, cli }) { | ||
| 51 | 51 | cli = path.resolve(__dirname, '../../', cli); | |
| 52 | 52 | const warmup = 3; | |
| 53 | - const state = { count, finished: -warmup }; | ||
| 53 | + const state = { n, finished: -warmup }; | ||
| 54 | 54 | spawnProcess(cli, bench, state); | |
| 55 | 55 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,12 +12,12 @@ const bench = common.createBenchmark(main, { | |||
| 12 | 12 | 'test/fixtures/snapshot/typescript', | |
| 13 | 13 | ], | |
| 14 | 14 | mode: ['process', 'worker'], | |
| 15 | - count: [30], | ||
| 15 | + n: [30], | ||
| 16 | 16 | }); | |
| 17 | 17 | ||
| 18 | 18 | function spawnProcess(script, bench, state) { | |
| 19 | 19 | const cmd = process.execPath || process.argv[0]; | |
| 20 | - while (state.finished < state.count) { | ||
| 20 | + while (state.finished < state.n) { | ||
| 21 | 21 | const child = spawnSync(cmd, [script]); | |
| 22 | 22 | if (child.status !== 0) { | |
| 23 | 23 | console.log('---- STDOUT ----'); | |
@@ -32,8 +32,8 @@ function spawnProcess(script, bench, state) { | |||
| 32 | 32 | bench.start(); | |
| 33 | 33 | } | |
| 34 | 34 | ||
| 35 | - if (state.finished === state.count) { | ||
| 36 | - bench.end(state.count); | ||
| 35 | + if (state.finished === state.n) { | ||
| 36 | + bench.end(state.n); | ||
| 37 | 37 | } | |
| 38 | 38 | } | |
| 39 | 39 | } | |
@@ -49,18 +49,18 @@ function spawnWorker(script, bench, state) { | |||
| 49 | 49 | // Finished warmup. | |
| 50 | 50 | bench.start(); | |
| 51 | 51 | } | |
| 52 | - if (state.finished < state.count) { | ||
| 52 | + if (state.finished < state.n) { | ||
| 53 | 53 | spawnWorker(script, bench, state); | |
| 54 | 54 | } else { | |
| 55 | - bench.end(state.count); | ||
| 55 | + bench.end(state.n); | ||
| 56 | 56 | } | |
| 57 | 57 | }); | |
| 58 | 58 | } | |
| 59 | 59 | ||
| 60 | - function main({ count, script, mode }) { | ||
| 60 | + function main({ n, script, mode }) { | ||
| 61 | 61 | script = path.resolve(__dirname, '../../', `${script}.js`); | |
| 62 | 62 | const warmup = 3; | |
| 63 | - const state = { count, finished: -warmup }; | ||
| 63 | + const state = { n, finished: -warmup }; | ||
| 64 | 64 | if (mode === 'worker') { | |
| 65 | 65 | Worker = require('worker_threads').Worker; | |
| 66 | 66 | spawnWorker(script, bench, state); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments