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

Function runScenario

scripts/bench/benchmark.js:17–41  ·  view source on GitHub ↗
(benchmark, chrome)

Source from the content-addressed store, hash-verified

15}
16
17async function runScenario(benchmark, chrome) {
18 const port = chrome.port;
19 const results = await Lighthouse(
20 `http://localhost:8080/${benchmark}/`,
21 {
22 output: 'json',
23 port,
24 },
25 config
26 );
27
28 const perfMarkings = results.lhr.audits['user-timings'].details.items;
29 const entries = perfMarkings
30 .filter(({timingType}) => timingType !== 'Mark')
31 .map(({duration, name}) => ({
32 entry: name,
33 time: duration,
34 }));
35 entries.push({
36 entry: 'First Meaningful Paint',
37 time: results.lhr.audits['first-meaningful-paint'].rawValue,
38 });
39
40 return entries;
41}
42
43function bootstrap(data) {
44 const len = data.length;

Callers 1

runBenchmarkFunction · 0.85

Calls 2

mapMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected