( baseMedian: number, headMedian: number, threshold: BenchmarkThreshold, )
| 141 | |
| 142 | /** Determine whether a comparable metric exceeded its material-regression threshold. */ |
| 143 | export function isMaterialRegression( |
| 144 | baseMedian: number, |
| 145 | headMedian: number, |
| 146 | threshold: BenchmarkThreshold, |
| 147 | ) { |
| 148 | const absoluteDelta = headMedian - baseMedian; |
| 149 | if (absoluteDelta <= 0) { |
| 150 | return false; |
| 151 | } |
| 152 | |
| 153 | if (absoluteDelta < threshold.minAbsoluteRegression) { |
| 154 | return false; |
| 155 | } |
| 156 | |
| 157 | if (baseMedian === 0) { |
| 158 | return headMedian > 0; |
| 159 | } |
| 160 | |
| 161 | return headMedian / baseMedian >= threshold.maxRegressionRatio; |
| 162 | } |
| 163 | |
| 164 | function relativeDelta(baseMedian: number, headMedian: number) { |
| 165 | if (baseMedian === 0) { |
no outgoing calls
no test coverage detected