We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
I noticed some weird results from our benchmarks when we moved our app from .net framework to .net 6.0.
Methods that should not allocate at all were reporting allocations of 8 bytes.
I've investigated and in trying to make a nice simple reproducible example I discovered that an empty method reports allocating 8 bytes
// * Summary * BenchmarkDotNet v0.13.7, Windows 10 (10.0.19045.3208/22H2/2022Update) 12th Gen Intel Core i7-1265U, 1 CPU, 12 logical and 10 physical cores .NET SDK 7.0.400 [Host] : .NET 6.0.21 (6.0.2123.36311), X64 RyuJIT AVX2 Job-NXFHSY : .NET 6.0.21 (6.0.2123.36311), X64 RyuJIT AVX2 Runtime=.NET 6.0 InvocationCount=64 IterationCount=10 LaunchCount=1 WarmupCount=8 | Method | Mean | Error | StdErr | StdDev | Min | Q1 | Median | Q3 | Max | Op/s | Rank | Allocated | |------------ |-------:|-------:|-------:|-------:|-------:|-------:|-------:|-------:|-------:|---------:|-----:|----------:| | EmptyMethod | 0.0 ns | 0.0 ns | 0.0 ns | 0.0 ns | 0.0 ns | 0.0 ns | 0.0 ns | 0.0 ns | 0.0 ns | Infinity | 1 | 8 B |
I've include the very basic set up I have below
Class Library defining the benchmarks - Target framework net6.0, single class
using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; using BenchmarkDotNet.Environments; using BenchmarkDotNet.Jobs; namespace BenchmarkTests { [MemoryDiagnoser] [Config(typeof(Config))] [RankColumn] [AllStatisticsColumn] public class Benchmarks { [Benchmark] public void EmptyMethod() { } private class Config : ManualConfig { public Config() { AddJob( new Job(EnvironmentMode.Default, RunMode.Short) { Environment = { Runtime = CoreRuntime.Core60 }, Run = { InvocationCount = 64, WarmupCount = 8, IterationCount = 10 } }); } } } }
Console App that runs the benchmarks - Target framework net6.0, single class to define entry point
using BenchmarkDotNet.Running; namespace BenchmarkTests.Runner { internal class Program { static void Main(string[] args) { BenchmarkRunner.Run<Benchmarks>(); } } }
The text was updated successfully, but these errors were encountered:
It's an issue in the runtime. See #1542 and #1543.
Sorry, something went wrong.
Thank you for the quick reply
No branches or pull requests
Hello,
I noticed some weird results from our benchmarks when we moved our app from .net framework to .net 6.0.
Methods that should not allocate at all were reporting allocations of 8 bytes.
I've investigated and in trying to make a nice simple reproducible example I discovered that an empty method reports allocating 8 bytes
I've include the very basic set up I have below
Class Library defining the benchmarks - Target framework net6.0, single class
Console App that runs the benchmarks - Target framework net6.0, single class to define entry point
The text was updated successfully, but these errors were encountered: