Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RunAllJoined should consider baseline per type #1164

Open
khellang opened this issue May 24, 2019 · 2 comments · May be fixed by #2163
Open

RunAllJoined should consider baseline per type #1164

khellang opened this issue May 24, 2019 · 2 comments · May be fixed by #2163
Assignees
Milestone

Comments

@khellang
Copy link
Member

If you have something like this

public class Program
{
    public static void Main(string[] args)
    {
        BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).RunAllJoined();
    }

    private static readonly Guid GuidValue = Guid.NewGuid();

    private static readonly string StringValue = GuidValue.ToString();

    [MemoryDiagnoser]
    public class Formatting
    {
        [Benchmark(Baseline = true)]
        public string Old()
        {
            return CompactGuidOld.ToCompactString(GuidValue);
        }

        [Benchmark]
        public string New()
        {
            return CompactGuid.ToString(GuidValue.ToUuid());
        }
    }

    [MemoryDiagnoser]
    public class Parsing
    {
        [Benchmark(Baseline = true)]
        public Guid Old()
        {
            CompactGuidOld.TryParse(StringValue, out var result);
            return result;
        }

        [Benchmark]
        public Guid New()
        {
            CompactGuid.TryParse(StringValue, out var result);
            return result.ToGuid();
        }
    }
}

I would expect my results to show both baselines (Formatting.Old and Parsing.Old) and the other benchmarks in the same type scaled based on each baseline.

Instead, the report only shows one baseline and the rest scaled based on that:

Type Method Mean Error StdDev Median Ratio RatioSD Gen 0 Gen 1 Gen 2 Allocated
Formatting Old 109.65 ns 2.5403 ns 4.1022 ns 109.02 ns 1.00 0.00 0.0191 - - 80 B
Parsing Old 17.03 ns 0.2582 ns 0.2416 ns 17.11 ns 0.15 0.01 - - - -
Formatting New 100.32 ns 2.2110 ns 6.2722 ns 98.11 ns 0.97 0.06 0.0191 - - 80 B
Parsing New 24.45 ns 0.5010 ns 0.4184 ns 24.44 ns 0.22 0.01 - - - -

Is this expected? Wouldn't it be better to group one baseline per type? This seems semi-related to #617, but that seems to be about categories.

@khellang
Copy link
Member Author

Oh, and this is running v0.11.5 😄

@AndreyAkinshin
Copy link
Member

@khellang thanks for the report!

@AndreyAkinshin AndreyAkinshin self-assigned this May 24, 2019
@adamsitnik adamsitnik added this to the v0.13.x milestone Oct 23, 2020
@YegorStepanov YegorStepanov linked a pull request Oct 18, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants