C#C
C#3y ago
83 replies
Jeroen (Speedzor)

❔ Benchmarking object size difference

I've got a small PR here to move a few bool fields into an existing "status" int. My understanding is that this would remove 16 bytes from the object size (1 byte padded to 8 bytes, twice). However when I create a small benchmark that just allocates a new Ping object, it retains the same size. Additionally, I'm not sure where the 184 bytes from the benchmark are coming from.

I'm sure I'm missing something elementary, does someone know what I'm overlooking here? https://github.com/dotnet/runtime/pull/94151
GitHub
Similar idea as #81251 and a couple of other examples described in the blog post. Instead of storing these flags in separate booleans, re-use the existing mechanism that stores them as separate val...
Re-use status flag inside Ping by Vannevelj · Pull Request #94151 ·...
Was this page helpful?