Home / Function/ percentChange() — react Function Reference

percentChange() — react Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

scripts/bench/stats.js lines 6–26

function percentChange(prev, current, prevSem, currentSem) {
  const [mean, sd] = calculateMeanAndSdOfRatioFromDeltaMethod(
    prev,
    current,
    prevSem,
    currentSem
  );
  const pctChange = +(mean * 100).toFixed(1);
  const ci95 = +(100 * 1.96 * sd).toFixed(1);

  const ciInfo = ci95 > 0 ? ` +- ${ci95} %` : '';
  const text = `${pctChange > 0 ? '+' : ''}${pctChange} %${ciInfo}`;
  if (pctChange + ci95 < 0) {
    return chalk.green(text);
  } else if (pctChange - ci95 > 0) {
    return chalk.red(text);
  } else {
    // Statistically insignificant.
    return text;
  }
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free