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

Function runBenchmarks

scripts/bench/runner.js:33–61  ·  view source on GitHub ↗
(reactPath)

Source from the content-addressed store, hash-verified

31const skipBuild = argv['skip-build'];
32
33async function runBenchmarks(reactPath) {
34 const benchmarkNames = getBenchmarkNames();
35 const results = {};
36 const server = serveBenchmark();
37 await wait(1000);
38
39 for (let i = 0; i < benchmarkNames.length; i++) {
40 const benchmarkName = benchmarkNames[i];
41
42 if (
43 !benchmarkFilter ||
44 (benchmarkFilter && benchmarkName.indexOf(benchmarkFilter) !== -1)
45 ) {
46 console.log(
47 chalk.gray(`- Building benchmark "${chalk.white(benchmarkName)}"...`)
48 );
49 await buildBenchmark(reactPath, benchmarkName);
50 console.log(
51 chalk.gray(`- Running benchmark "${chalk.white(benchmarkName)}"...`)
52 );
53 results[benchmarkName] = await runBenchmark(benchmarkName, headless);
54 }
55 }
56
57 server.close();
58 // http-server.close() is async but they don't provide a callback..
59 await wait(500);
60 return results;
61}
62
63// get the performance benchmark results
64// from remote main (default React repo)

Callers 2

benchmarkRemoteMasterFunction · 0.85
benchmarkLocalFunction · 0.85

Calls 6

getBenchmarkNamesFunction · 0.85
serveBenchmarkFunction · 0.85
buildBenchmarkFunction · 0.85
runBenchmarkFunction · 0.85
waitFunction · 0.70
closeMethod · 0.65

Tested by

no test coverage detected