({ n, count })
| 33 | } |
| 34 | |
| 35 | function main({ n, count }) { |
| 36 | const dir = mkdtempSync(path.join(tmpdir(), 'node-bench-snapshot-')); |
| 37 | const snapshotBlob = path.join(dir, 'snapshot.blob'); |
| 38 | const fixtureScript = path.join(dir, 'build.js'); |
| 39 | |
| 40 | try { |
| 41 | buildSnapshot(snapshotBlob, fixtureScript, count); |
| 42 | |
| 43 | const warmup = 3; |
| 44 | let finished = -warmup; |
| 45 | |
| 46 | while (finished < n) { |
| 47 | const child = spawnSync(process.execPath, ['--snapshot-blob', snapshotBlob]); |
| 48 | if (child.status !== 0) { |
| 49 | throw new Error(`Snapshot run failed:\n${child.stderr}`); |
| 50 | } |
| 51 | finished++; |
| 52 | if (finished === 0) bench.start(); |
| 53 | if (finished === n) bench.end(n); |
| 54 | } |
| 55 | } finally { |
| 56 | rmSync(dir, { recursive: true, force: true }); |
| 57 | } |
| 58 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…