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

Function runBenchmark

benchmark/calibrate-n.js:95–121  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

93}
94
95function runBenchmark(n) {
96 return new Promise((resolve, reject) => {
97 const child = fork(
98 fullBenchmarkPath,
99 [`n=${n}`],
100 { stdio: ['inherit', 'pipe', 'inherit', 'ipc'] },
101 );
102
103 const results = [];
104 child.on('message', (data) => {
105 if (data.type === 'report' && data.rate && data.conf) {
106 results.push({
107 rate: data.rate,
108 conf: data.conf,
109 });
110 }
111 });
112
113 child.on('close', (code) => {
114 if (code !== 0) {
115 reject(new Error(`Benchmark exited with code ${code}`));
116 } else {
117 resolve(results);
118 }
119 });
120 });
121}
122
123async function main(n = startN) {
124 let increaseCount = 0;

Callers 1

mainFunction · 0.70

Calls 5

forkFunction · 0.50
rejectFunction · 0.50
resolveFunction · 0.50
onMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…