MCPcopy Create free account
hub / github.com/adobe/react-spectrum / topInvoker

Function topInvoker

perf/report.mjs:73–84  ·  view source on GitHub ↗
(samples)

Source from the content-addressed store, hash-verified

71}
72
73function topInvoker(samples) {
74 let totals = new Map();
75 for (let script of samples.flatMap(sample => sample.longFrames.flatMap(frame => frame.scripts))) {
76 totals.set(script.invoker, (totals.get(script.invoker) ?? 0) + script.duration);
77 }
78 let [invoker] = [...totals].sort((a, b) => b[1] - a[1])[0] ?? [];
79 if (!invoker) {
80 return '—';
81 }
82 let text = invoker.length > 60 ? `${invoker.slice(0, 59)}…` : invoker;
83 return `\`${text.replaceAll('|', '\\|').replaceAll('`', "'")}\``;
84}
85
86function longFrameRows(result) {
87 let rows = [];

Callers 1

longFrameRowsFunction · 0.85

Calls 3

sliceMethod · 0.80
sortMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected