From b6a59d3fd36108ad9234c0bf76a34ec19eb2557f Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Wed, 20 Nov 2024 13:13:15 +0800 Subject: [PATCH] feat: rss-memory metric (#57) --- lib/compare.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/compare.js b/lib/compare.js index 204df3a1..0aa51b51 100644 --- a/lib/compare.js +++ b/lib/compare.js @@ -20,7 +20,12 @@ function getOverThresholdTags(diff) { if (typeof data.baseMean !== 'number') { return null; } - if (data.currentMean / data.baseMean < 1.05) { + if (tag.endsWith("memory")) { + if (data.currentMean / data.baseMean < 1.3) { + // The memory usage is unstable (with fluctuations of approximately 20%) during Hot Module Replacement (HMR), so it won't be counted for now. + return null; + } + } else if (data.currentMean / data.baseMean < 1.05) { return null; } return tag; @@ -76,7 +81,7 @@ async function getResults(date, index, benchmarkDirectory) { } export async function compare(base, current, benchmarkDirectory) { - const compareMetric = ["exec"]; + const compareMetric = ["exec", "rss memory"]; const index = await fetchIndex(); if (base === "latest") {