Skip to content

Commit 5aea977

Browse files
committed
ci: make ratio non-absolute
Signed-off-by: Vincent Biret <[email protected]>
1 parent 3ee8ad8 commit 5aea977

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

performance/resultsComparer/policies/PercentageMemoryUsagePolicy.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ public override bool Equals(BenchmarkMemory? x, BenchmarkMemory? y)
5656
}
5757
private static double GetPercentageDifference(BenchmarkMemory x, BenchmarkMemory y)
5858
{
59-
return Math.Truncate(Math.Abs(GetAbsoluteRatio(x, y)) * 10000) / 100;
59+
return Math.Truncate(Math.Abs(GetRatio(x, y)) * 10000) / 100;
6060
}
61-
private static double GetAbsoluteRatio(BenchmarkMemory x, BenchmarkMemory y)
61+
private static double GetRatio(BenchmarkMemory x, BenchmarkMemory y)
6262
{
63-
return Math.Abs(((double)(x.AllocatedBytes - y.AllocatedBytes))/x.AllocatedBytes);
63+
return (double)(x.AllocatedBytes - y.AllocatedBytes) / x.AllocatedBytes;
6464
}
6565
public override string GetErrorMessage(BenchmarkMemory? x, BenchmarkMemory? y)
6666
{
6767
if (x is null || y is null)
6868
{
6969
return "One of the benchmarks is null.";
7070
}
71-
return $"Allocated bytes differ: {x.AllocatedBytes} != {y.AllocatedBytes}, Ratio: {GetAbsoluteRatio(x, y)}, Allowed: {TolerancePercentagePoints}%";
71+
return $"Allocated bytes differ: {x.AllocatedBytes} != {y.AllocatedBytes}, Ratio: {GetRatio(x, y)}, Allowed: {TolerancePercentagePoints}%";
7272
}
7373
}

0 commit comments

Comments
 (0)