Skip to content

Commit

Permalink
e2e: add lowerIsBetter for e2e metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Aug 2, 2024
1 parent 4f16e26 commit 83e36dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/e2e/compare/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ const PROBABILITY_CONSIDERED_SIGNIFICANCE = 0.02;
*/
const DURATION_DIFF_THRESHOLD_SIGNIFICANCE = 100;

const LowerIsBetter: Record<Unit, boolean> = {
ms: true,
MB: true,
// eslint-disable-next-line @typescript-eslint/naming-convention
'%': true,
renders: true,
FPS: false,
};

function buildCompareEntry(name: string, compare: Stats, baseline: Stats, unit: Unit): Entry {
const diff = compare.mean - baseline.mean;
const relativeDurationDiff = diff / baseline.mean;
Expand All @@ -44,7 +53,7 @@ function buildCompareEntry(name: string, compare: Stats, baseline: Stats, unit:
baseline,
current: compare,
diff,
relativeDurationDiff,
relativeDurationDiff: LowerIsBetter[unit] ? relativeDurationDiff : -relativeDurationDiff,
isDurationDiffOfSignificance,
};
}
Expand Down

0 comments on commit 83e36dd

Please sign in to comment.