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

Function report

perf/report.mjs:371–505  ·  view source on GitHub ↗
(result)

Source from the content-addressed store, hash-verified

369const ms = value => (value === null ? 'unavailable' : `${value.toFixed(2)} ms`);
370
371export function report(result) {
372 let lines = [
373 '# React Aria local benchmark',
374 '',
375 `${result.started} · Chromium ${result.environment.browser} · React ${result.builds.base.versions.react}`,
376 '',
377 `${result.environment.mode ?? 'test'} · ${result.options.cpu ?? 1}× CPU slowdown · ${result.options.scale ?? 1}× workload · ${result.environment.cpu ?? 'CPU not recorded'}`,
378 '',
379 `Base: ${result.builds.base.name} (${result.builds.base.source.sha.slice(0, 10)}).${result.builds.candidate ? ` Candidate: ${result.builds.candidate.name} (${result.builds.candidate.source.sha.slice(0, 10)}).` : ''}`,
380 '',
381 `${result.options.blocks} browser-launch blocks × ${result.options.samples} measured trials per arm; ${result.options.warmup} discarded warmups per scenario/arm/block.`,
382 '',
383 'Times below are medians. Completion uses a two-animation-frame rendering-opportunity proxy, not presented-pixel timing. Scrolling and continuous resizing use the mean rAF interval within each trial, not compositor frame delivery.',
384 '',
385 'Decision thresholds are exploratory defaults, not calibrated merge criteria. Changes are Hodges–Lehmann estimates of the per-block paired change, with exact Wilcoxon signed-rank intervals at the smallest achievable confidence of at least 95%; fewer than six blocks cannot reach 95% and are always inconclusive. Multiple scenarios are exploratory comparisons, not a family-wide significance test.',
386 ''
387 ];
388 if (result.options.delay) {
389 let where = {
390 input: 'synchronous work to the measured input event',
391 frame: 'synchronous work to every frame of the measurement window'
392 }[result.options.delayMode];
393 lines.push(
394 where
395 ? `Calibration: candidate adds ${result.options.delay} ms of ${where}.`
396 : `Calibration: candidate mount adds ${result.options.delay} ms of ${result.options.delayMode} work.`,
397 ''
398 );
399 }
400 if (result.status === 'running') {
401 let completed = new Set(result.samples.map(sample => sample.block)).size;
402 lines.push(
403 `**IN PROGRESS / INCOMPLETE: ${completed} of ${result.options.blocks} blocks saved.**`,
404 '',
405 'Partial samples are retained; comparison verdicts are produced only when the run completes.',
406 ''
407 );
408 return lines.join('\n');
409 }
410 if (result.status !== 'complete') {
411 lines.push(
412 `**FAILED / INCOMPLETE: ${result.error ?? 'run interrupted'}**`,
413 '',
414 'Partial samples are retained for diagnosis; no comparison verdicts are produced.',
415 ''
416 );
417 return lines.join('\n');
418 }
419 lines.push(
420 '| Scenario | Metric | Base | Candidate | Paired change | Interval of change (confidence) | Result |',
421 '|---|---|---:|---:|---:|---|---|'
422 );
423 result.comparisons = {};
424 for (let scenario of result.scenarios) {
425 let samples = result.samples.filter(sample => sample.scenario === scenario.id);
426 let metric = scenario.metric ?? 'opportunity';
427 if (result.builds.candidate) {
428 let comparison = compare(samples, metric, {

Callers 2

persistFunction · 0.90
report.test.mjsFile · 0.90

Calls 10

percentileFunction · 0.85
launchSectionFunction · 0.85
medianFunction · 0.85
longFrameRowsFunction · 0.85
traceSectionFunction · 0.85
sliceMethod · 0.80
pushMethod · 0.80
compareFunction · 0.70
msFunction · 0.70
filterMethod · 0.65

Tested by

no test coverage detected