MCPcopy Index your code
hub / github.com/react/react / runBenchmark

Function runBenchmark

scripts/bench/benchmark.js:107–128  ·  view source on GitHub ↗
(benchmark, headless)

Source from the content-addressed store, hash-verified

105}
106
107async function runBenchmark(benchmark, headless) {
108 const results = {
109 runs: [],
110 averages: [],
111 };
112
113 await initChrome();
114
115 for (let i = 0; i < timesToRun; i++) {
116 let chrome = await launchChrome(headless);
117
118 results.runs.push(await runScenario(benchmark, chrome));
119 // add a delay or sometimes it confuses lighthouse and it hangs
120 await wait(500);
121 try {
122 await chrome.kill();
123 } catch (e) {}
124 }
125
126 results.averages = calculateAverages(results.runs);
127 return results;
128}
129
130module.exports = runBenchmark;

Callers 1

runBenchmarksFunction · 0.85

Calls 6

initChromeFunction · 0.85
launchChromeFunction · 0.85
runScenarioFunction · 0.85
calculateAveragesFunction · 0.85
waitFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected