BenchmarkDotNet icon indicating copy to clipboard operation
BenchmarkDotNet copied to clipboard

improve BaselineCustomAnalyzer warning message, fixes #2591

Open znxftw opened this issue 1 year ago • 0 comments

Went through #2591 and tried to improve the warning message here - taking a look at what code paths can cause this warning, I see that in BaseLineCustomColumn.ResultsAreInvalid it checks for whether the baseline / benchmark (or the results of) was null, and a check for !CanBeInverted on the baseline which checks if it's too close to zero.

internal static bool ResultsAreInvalid(Summary summary, BenchmarkCase benchmarkCase, BenchmarkCase? baseline)
{
    return baseline == null ||
           summary[baseline] == null ||
           summary[baseline].ResultStatistics == null ||
           !summary[baseline].ResultStatistics.CanBeInverted() ||
           summary[benchmarkCase] == null ||
           summary[benchmarkCase].ResultStatistics == null;
}
 public bool CanBeInverted() => Min > 1e-9;

First issue here, let me know if this analysis is right / what other changes I need to make before this can be merged. Thanks! :)

znxftw avatar Sep 26 '24 12:09 znxftw