MCPcopy Create free account
hub / github.com/WebMCP-org/chrome-devtools-quickstart / formatDiff

Function formatDiff

benchmark/helpers.ts:899–913  ·  view source on GitHub ↗
(
    ss: number,
    wm: number,
    isLowerBetter = true
  )

Source from the content-addressed store, hash-verified

897 });
898
899 const formatDiff = (
900 ss: number,
901 wm: number,
902 isLowerBetter = true
903 ): string => {
904 const diff = ss - wm;
905 const pct =
906 ss > 0 ? ((diff / ss) * 100).toFixed(1) : "0.0";
907 const arrow = diff > 0 ? "↓" : diff < 0 ? "↑" : "=";
908 const color =
909 (isLowerBetter ? diff > 0 : diff < 0) ? chalk.green : chalk.red;
910 return color(
911 `${formatNumber(Math.abs(Math.round(diff)))} (${arrow}${Math.abs(parseFloat(pct))}%)`
912 );
913 };
914
915 table.push(
916 [

Callers 1

Calls 1

formatNumberFunction · 0.85

Tested by

no test coverage detected