bug? When using the Ctrl+ShiftB benchmarking support, AllocatedBytes always shows "null"
Reproduce with:
10.ToString().Dump();
mark the line, hit Ctrl+ShiftB, and note that AllocatedBytes shows "null", even though this line does allocate a string:
IL_0000 ldc.i4.s 0A // 10 IL_0002 stloc.0 IL_0003 ldloca.s 00 IL_0005 call Int32.ToString () // <-- here IL_000A call Extensions.Dump<String> (String) // <-- and I assume here IL_000F pop IL_0010 ret
It seems that in the following line of code:
public long? BytesPerOperation => TotalOperations == 0 ? null : TotalAllocatedBytes / TotalOperations;
TotalOperations
is always 0, as is TotalAllocatedBytes
, though I'm not familiar enough with how BenchMarkDotNet reports data to look further into why.
Reproduced with LINQPad Beta 7.8.1 and release 7.7.15.
Comments
When testing the configuration using the following code, I do get output that contains memory allocations, so the configuration of BenchmarkDotNet is correct:
code:
See https://forum.linqpad.net/discussion/2948/benchmark-allocatedbytes-column-always-null#latest