MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

benchmark/v8/startup-snapshot-callbacks.js:35–58  ·  view source on GitHub ↗
({ n, count })

Source from the content-addressed store, hash-verified

33}
34
35function 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}

Callers

nothing calls this directly

Calls 8

tmpdirFunction · 0.85
buildSnapshotFunction · 0.70
mkdtempSyncFunction · 0.50
spawnSyncFunction · 0.50
rmSyncFunction · 0.50
joinMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…