Skip to main content
This is lesson 15 of 15 in this module Course 75% complete

Demo: Benchmarking Structs versus Classes

Premium Content

Sign in with your account or sign up to access this lesson.

In this live walkthrough of the structs-vs-classes benchmark code, we compare memory allocation and garbage collector pressure between a list of value-type structs and a list of reference-type classes. The lesson uses the BenchmarkDotNet MemoryDiagnoser results to show that the class scenario uses 4x more memory than the structs scenario.