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

[MemoryDiagnoser] Shows strange values for 'almost' empty benchmarks #2321

Closed
ApmeM opened this issue Jun 7, 2023 · 3 comments
Closed

[MemoryDiagnoser] Shows strange values for 'almost' empty benchmarks #2321

ApmeM opened this issue Jun 7, 2023 · 3 comments

Comments

@ApmeM
Copy link

ApmeM commented Jun 7, 2023

I have created a very simple almost empty benchmark.
Full code is here:

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

[MemoryDiagnoser]
public class Program
{
    public static void Main(string[] args)
    {
        BenchmarkRunner.Run<Program>();
    }

    [Benchmark]
    public void Test()
    {
        for (var i = 0; i < 10000000; i++)
        {
        }
    }
}

So effectively there is only a single loop from 1 to 10000000 without any calculations in it.

The benchmark result shows this:

BenchmarkDotNet=v0.13.1, OS=debian 11
Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R), 1 CPU, 8 logical and 4 physical cores
.NET SDK=7.0.203
[Host] : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT
DefaultJob : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT

Method Mean Error StdDev Allocated
Test 2.605 ms 0.0169 ms 0.0141 ms 3 B

Where those 3 bytes come from?
I run this code with this command:

dotnet run -c Release
@timcassell
Copy link
Collaborator

See #1543

@ApmeM
Copy link
Author

ApmeM commented Jun 8, 2023

Ok, thanks, it looks related, so closing this bug as duplicate.

@adamsitnik
Copy link
Member

Closing as a duplicate of #1542, @ApmeM as a workaround you can disable the Tiered JIT via env var.

@adamsitnik adamsitnik closed this as not planned Won't fix, can't repro, duplicate, stale Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants