Home / Function/ addBenchmarkResults() — react Function Reference

addBenchmarkResults() — react Function Reference

Architecture documentation for the addBenchmarkResults() function in stats.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  248a497d_d5ff_c575_bf7e_c4030daab7d4["addBenchmarkResults()"]
  2c40123c_d029_f3b5_b70a_412fb8cb4b6f["stats.js"]
  248a497d_d5ff_c575_bf7e_c4030daab7d4 -->|defined in| 2c40123c_d029_f3b5_b70a_412fb8cb4b6f
  7e3d6848_fbd8_9106_91e2_33421e7ff2ef["printResults()"]
  7e3d6848_fbd8_9106_91e2_33421e7ff2ef -->|calls| 248a497d_d5ff_c575_bf7e_c4030daab7d4
  a69cff7d_0cd6_6242_3662_d657397775ef["percentChange()"]
  248a497d_d5ff_c575_bf7e_c4030daab7d4 -->|calls| a69cff7d_0cd6_6242_3662_d657397775ef
  style 248a497d_d5ff_c575_bf7e_c4030daab7d4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/bench/stats.js lines 43–94

function addBenchmarkResults(table, localResults, remoteMasterResults) {
  const benchmarks = Object.keys(
    (localResults && localResults.benchmarks) ||
      (remoteMasterResults && remoteMasterResults.benchmarks)
  );
  benchmarks.forEach(benchmark => {
    const rowHeader = [chalk.white.bold(benchmark)];
    if (remoteMasterResults) {
      rowHeader.push(chalk.white.bold('Time'));
    }
    if (localResults) {
      rowHeader.push(chalk.white.bold('Time'));
    }
    if (localResults && remoteMasterResults) {
      rowHeader.push(chalk.white.bold('Diff'));
    }
    table.push(rowHeader);

    const measurements =
      (localResults && localResults.benchmarks[benchmark].averages) ||
      (remoteMasterResults &&
        remoteMasterResults.benchmarks[benchmark].averages);
    measurements.forEach((measurement, i) => {
      const row = [chalk.gray(measurement.entry)];
      let remoteMean;
      let remoteSem;
      if (remoteMasterResults) {
        remoteMean = remoteMasterResults.benchmarks[benchmark].averages[i].mean;
        remoteSem = remoteMasterResults.benchmarks[benchmark].averages[i].sem;
        // https://en.wikipedia.org/wiki/1.96 gives a 99% confidence interval.
        const ci95 = remoteSem * 1.96;
        row.push(
          chalk.white(+remoteMean.toFixed(2) + ' ms +- ' + ci95.toFixed(2))
        );
      }
      let localMean;
      let localSem;
      if (localResults) {
        localMean = localResults.benchmarks[benchmark].averages[i].mean;
        localSem = localResults.benchmarks[benchmark].averages[i].sem;
        const ci95 = localSem * 1.96;
        row.push(
          chalk.white(+localMean.toFixed(2) + ' ms +- ' + ci95.toFixed(2))
        );
      }
      if (localResults && remoteMasterResults) {
        row.push(percentChange(remoteMean, localMean, remoteSem, localSem));
      }
      table.push(row);
    });
  });
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does addBenchmarkResults() do?
addBenchmarkResults() is a function in the react codebase, defined in scripts/bench/stats.js.
Where is addBenchmarkResults() defined?
addBenchmarkResults() is defined in scripts/bench/stats.js at line 43.
What does addBenchmarkResults() call?
addBenchmarkResults() calls 1 function(s): percentChange.
What calls addBenchmarkResults()?
addBenchmarkResults() is called by 1 function(s): printResults.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free